修复问题:单选模式下多个日期被选中

去掉默认dispose会销毁数据,提供方法让用户手动销毁数据clearData
develop^2
LXD312569496 5 years ago committed by xiaodong
parent 21fdeb5595
commit ecd90edbc4

@ -502,6 +502,8 @@ class CalendarController {
monthList.clear(); monthList.clear();
weekList.clear(); weekList.clear();
calendarProvider.clearData(); calendarProvider.clearData();
calendarConfiguration.weekChangeListeners=null;
calendarConfiguration.monthChangeListeners=null;
} }
} }

@ -69,7 +69,7 @@ class _CalendarViewWidgetState extends State<CalendarViewWidget> {
@override @override
void dispose() { void dispose() {
widget.calendarController.clearData(); // widget.calendarController.clearData();
super.dispose(); super.dispose();
} }

@ -162,12 +162,13 @@ class ItemContainerState extends State<ItemContainer> {
dateModel = widget.dateModel; dateModel = widget.dateModel;
isSelected = ValueNotifier(dateModel.isSelected); isSelected = ValueNotifier(dateModel.isSelected);
WidgetsBinding.instance.addPostFrameCallback((callback) { //
if (configuration.selectMode == CalendarConstants.MODE_SINGLE_SELECT && // WidgetsBinding.instance.addPostFrameCallback((callback) {
dateModel.isSelected) { // if (configuration.selectMode == CalendarConstants.MODE_SINGLE_SELECT &&
calendarProvider.lastClickItemState = this; // dateModel.isSelected) {
} // calendarProvider.lastClickItemState = this;
}); // }
// });
} }
/** /**

Loading…
Cancel
Save