initData method
void
initData()
Implementation
void initData() {
// 传入的选择开始日期
selectStartTime =
TWCalendarTool.onlyDay(widget.calendarController.selectedStartDate);
// 传入的选择结束日期
selectEndTime =
TWCalendarTool.onlyDay(widget.calendarController.selectedEndDate);
// 开始年份
yearStart = widget.calendarController.firstDate.year;
// 结束年份
yearEnd = widget.calendarController.lastDate.year;
// 开始月份
monthStart = widget.calendarController.firstDate.month;
// 结束月份
monthEnd = widget.calendarController.lastDate.month;
// 总月数
count = monthEnd - monthStart + (yearEnd - yearStart) * 12 + 1;
selectedMode = widget.configs?.listConfig?.selectedMode ??
TWCalendarListSelectedMode.singleSerial;
// 📢 非连续的选择数组非空,则 selectedMode = TWCalendarListSelectedMode.notSerial;
if (widget.calendarController.notSerialSelectedDates != null) {
notSerialSelectedTimes =
widget.calendarController.notSerialSelectedDates!;
_handleMultipleStartEndTime();
selectedMode = TWCalendarListSelectedMode.notSerial;
}
// 初始化选择天数
_updateSelectedDays();
}