setMiddleIndex method Null safety

  1. @override
void setMiddleIndex(
  1. int index
)
override

Implementation

@override
void setMiddleIndex(int index) {
  super.setMiddleIndex(index);
  DateTime time = currentTime.add(Duration(days: _currentLeftIndex));
  if (isAtSameDay(minTime, time) && index == 0) {
    var maxIndex = 60 - minTime!.minute - 1;
    if (_currentRightIndex > maxIndex) {
      _currentRightIndex = maxIndex;
    }
  } else if (isAtSameDay(maxTime, time) &&
      _currentMiddleIndex == maxTime!.hour) {
    var maxIndex = maxTime!.minute;
    if (_currentRightIndex > maxIndex) {
      _currentRightIndex = maxIndex;
    }
  }
}