setLeftIndex method

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

Implementation

@override
void setLeftIndex(int index) {
  super.setLeftIndex(index);
  //adjust middle
  int destYear = index + minTime.year;
  int minMonth = _minMonthOfCurrentYear();
  DateTime newTime;
  //change date time
  if (currentTime.month == 2 && currentTime.day == 29) {
    newTime = currentTime.isUtc
        ? DateTime.utc(
            destYear,
            currentTime.month,
            calcDateCount(destYear, 2),
          )
        : DateTime(
            destYear,
            currentTime.month,
            calcDateCount(destYear, 2),
          );
  } else {
    newTime = currentTime.isUtc
        ? DateTime.utc(
            destYear,
            currentTime.month,
            currentTime.day,
          )
        : DateTime(
            destYear,
            currentTime.month,
            currentTime.day,
          );
  }
  //min/max check
  if (newTime.isAfter(maxTime)) {
    currentTime = maxTime;
  } else if (newTime.isBefore(minTime)) {
    currentTime = minTime;
  } else {
    currentTime = newTime;
  }

  _fillMiddleLists();
  _fillRightLists();
  minMonth = _minMonthOfCurrentYear();
  int minDay = _minDayOfCurrentMonth();
  _currentMiddleIndex = currentTime.month - minMonth;
  _currentRightIndex = currentTime.day - minDay;
}