refreshDayDataAndController method

void refreshDayDataAndController()

Implementation

void refreshDayDataAndController() {
  /// 在刷新日数据时,年月数据已经是最新的
  var selectedYear = yearIndex + data[0][0];
  var selectedMonth = monthIndex + data[1][0];
  if (dateEnd[0] == dateStart[0] && dateEnd[1] == dateStart[1]) {
    data[2] = List.generate(
        dateEnd[2] - dateStart[2] + 1, (index) => index + dateStart[2]);
  } else if (selectedYear == dateStart[0] && selectedMonth == dateStart[1]) {
    data[2] = List.generate(
        DateTime(selectedYear, selectedMonth + 1, 0).day - dateStart[2] + 1,
        (index) => index + dateStart[2]);
  } else if (selectedYear == dateEnd[0] && selectedMonth == dateEnd[1]) {
    data[2] = List.generate(dateEnd[2], (index) => index + 1);
  } else {
    data[2] = List.generate(DateTime(selectedYear, selectedMonth + 1, 0).day,
        (index) => index + 1);
  }
  dayFixedExtentScrollController.jumpToItem(
      dayIndex > data[2].length - 1 ? data[2].length - 1 : dayIndex);
}