创建configuration类,将配置的信息放到这里

引入provider状态管理,避免深层嵌套传递信息
周视图和月视图,联动
增加日志输出类LogUtil,方便查看调试
增加example例子
性能优化
develop
LXD312569496 5 years ago committed by xiaodong
parent 6dcf7c21a2
commit 8ff63215f4

@ -49,13 +49,31 @@ class _WeekViewPagerState extends State<WeekViewPager> {
height: configuration.itemSize ?? MediaQuery.of(context).size.width / 7,
child: PageView.builder(
onPageChanged: (position) {
if (calendarProvider.expandStatus.value == true) {
return;
}
LogUtil.log(
TAG: this.runtimeType,
message: "WeekViewPager PageView onPageChanged:${position}");
//
DateModel firstDayOfWeek = configuration.weekList[position];
int currentMonth = firstDayOfWeek.month;
if (lastMonth != currentMonth) {
LogUtil.log(
TAG: this.runtimeType,
message:
"WeekViewPager PageView monthChange:currentMonth:${currentMonth}");
configuration.monthChange(
firstDayOfWeek.year, firstDayOfWeek.month);
lastMonth = currentMonth;
if (calendarProvider.lastClickDateModel == null ||
calendarProvider.lastClickDateModel.month != currentMonth) {
DateModel temp = new DateModel();
temp.year = firstDayOfWeek.year;
temp.month = firstDayOfWeek.month;
temp.day = firstDayOfWeek.day + 14;
calendarProvider.lastClickDateModel = temp;
}
}
// calendarProvider.lastClickDateModel = configuration.weekList[position]
// ..day += 4;

Loading…
Cancel
Save