updateFirstIndex method Null safety

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

更新第一列index

Implementation

@override
void updateFirstIndex(int index) {
  super.updateFirstIndex(index);

  int destYear = index + minTime.year;
  int minMonth = _minMonthOfCurrentYear();

  DateTime newTime;
  int newDay = currentTime.day;
  //change date time
  if (currentTime.month == 2 && currentTime.day == 29) {
    newDay = calcDateCount(destYear, 2);
  }
  newTime = currentTime.isUtc
      ? DateTime.utc(
          destYear,
          currentTime.month,
          newDay,
        )
      : DateTime(
          destYear,
          currentTime.month,
          newDay,
        );

  //min/max check
  _checkTime(newTime);

  _fillMonthList();
  _fillDayList();
  minMonth = _minMonthOfCurrentYear();
  int minDay = _minDayOfCurrentMonth();
  secondIndex = currentTime.month - minMonth;
  thirdIndex = currentTime.day - minDay;
}