updateFirstIndex method Null safety

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

更新第一列index

Implementation

@override
void updateFirstIndex(int index) {
  firstIndex = index;

  int destYear = index + minTime.year;
  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,
          currentTime.hour,
          currentTime.minute,
          currentTime.second,
        )
      : DateTime(
          destYear,
          currentTime.month,
          newDay,
          currentTime.hour,
          currentTime.minute,
          currentTime.second,
        );
  //min/max check
  _checkTime(newTime);

  _fillMonthList();
  _fillDayList();
  int minMonth = _minMonthOfCurrentYear();
  int minDay = _minDayOfCurrentMonth();
  int minHour = _minHourOfCurrentDay();
  int minMinute = _minMinuteOfCurrentHour();
  int minSecond = _minSecondOfCurrentMinute();

  secondIndex = currentTime.month - minMonth;
  thirdIndex = currentTime.day - minDay;
  fourthIndex = currentTime.hour - minHour;
  fifthIndex = currentTime.minute - minMinute;
  sixtyIndex = currentTime.second - minSecond;
}