diff --git a/lib/widget/month_view.dart b/lib/widget/month_view.dart index bdbafd7..e7b503d 100644 --- a/lib/widget/month_view.dart +++ b/lib/widget/month_view.dart @@ -174,7 +174,7 @@ class ItemContainerState extends State { /** * 提供方法给外部,可以调用这个方法进行刷新item */ - void refreshItem() { + void refreshItem(bool v) { /** Exception caught by gesture The following assertion was thrown while handling a gesture: @@ -182,7 +182,7 @@ class ItemContainerState extends State { */ if (mounted) { setState(() { - dateModel.isSelected = !dateModel.isSelected; + dateModel.isSelected = v; // isSelected.value = !isSelected.value; }); } @@ -237,12 +237,11 @@ class ItemContainerState extends State { //单选需要刷新上一个item if (calendarProvider.lastClickItemState != this) { - calendarProvider.lastClickItemState?.refreshItem(); + calendarProvider.lastClickItemState?.refreshItem(false); calendarProvider.lastClickItemState = this; } } - - refreshItem(); + refreshItem(!this.dateModel.isSelected); }, child: configuration.dayWidgetBuilder(dateModel), ); diff --git a/pubspec.yaml b/pubspec.yaml index 8d075d6..b96cb8a 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -10,7 +10,7 @@ environment: dependencies: flutter: sdk: flutter - provider: ^3.1.0+1 + provider: ^4.0.4 dev_dependencies: flutter_test: sdk: flutter