currentDayPage method
当前月page
Implementation
Future<bool> currentDayPage() async {
var nowDate = DateTime.now();
if (calendarLogic.expandStatus.value == true) {
//计算目标索引
var targetDate = _getNowTimeMonthPage(nowDate);
var targetPage = monthList.indexOf(targetDate);
int currentIndex = calendarLogic.calendarConfiguration.monthController!.page!.toInt();
if (currentIndex == targetPage) {
return false;
} else {
calendarLogic.calendarConfiguration.monthController ?.animateToPage( targetPage, duration: Duration(milliseconds: 300), curve: Curves.ease);
calendarLogic.calendarConfiguration.monthChangeListeners
.forEach((listener) {
listener(targetDate.year, targetDate.month);
});
// DateModel temp = new DateModel();
// temp.year = monthList[currentIndex].year;
// temp.month = monthList[currentIndex].month;
// temp.day = monthList[currentIndex].day + 14;
print('298 周视图的变化: $targetDate');
calendarLogic.lastClickDateModel = targetDate;
return true;
}
} else {
//周视图
int currentIndex = calendarLogic.calendarConfiguration.weekController!.page!.toInt();
DateModel dateModel = _getNowTimeWeekPage(nowDate);
//计算目标索引
int targetPage = weekList.indexOf(dateModel);
if (currentIndex == targetPage) {
return false;
} else {
calendarLogic.calendarConfiguration.weekController
?.animateToPage( targetPage, duration: DEFAULT_DURATION, curve: Curves.ease);
return true;
}
}
}