middleStringAtIndex method

  1. @override
String? middleStringAtIndex(
  1. int index
)
override

Implementation

@override
String? middleStringAtIndex(int index) {
  if (index >= 0 && index < 24) {
    DateTime time = currentTime.add(Duration(days: _currentLeftIndex));
    if (isAtSameDay(minTime, time)) {
      if (index >= 0 && index < 24 - minTime!.hour) {
        return digits(minTime!.hour + index, 2);
      } else {
        return null;
      }
    } else if (isAtSameDay(maxTime, time)) {
      if (index >= 0 && index <= maxTime!.hour) {
        return digits(index, 2);
      } else {
        return null;
      }
    }
    return digits(index, 2);
  }

  return null;
}