From 1e64b21b40d0d1c06dd306bd08e267c6b169b8db Mon Sep 17 00:00:00 2001 From: nyne Date: Wed, 18 Sep 2024 21:55:01 +0800 Subject: [PATCH] fix the issue that the local favorite top bar was not updated after canceling a favorite item --- lib/pages/favorites/main_favorites_page.dart | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/pages/favorites/main_favorites_page.dart b/lib/pages/favorites/main_favorites_page.dart index 445897d4..a57b4a07 100644 --- a/lib/pages/favorites/main_favorites_page.dart +++ b/lib/pages/favorites/main_favorites_page.dart @@ -5,12 +5,13 @@ import "package:flutter/material.dart"; import "package:flutter_reorderable_grid_view/widgets/reorderable_builder.dart"; import "package:pica_comic/base.dart"; import "package:pica_comic/comic_source/comic_source.dart"; +import 'package:pica_comic/components/components.dart'; import "package:pica_comic/foundation/app.dart"; import "package:pica_comic/foundation/local_favorites.dart"; import "package:pica_comic/foundation/log.dart"; import "package:pica_comic/network/download.dart"; import "package:pica_comic/tools/translations.dart"; -import 'package:pica_comic/components/components.dart'; + import "../../network/net_fav_to_local.dart"; import "../../tools/io_tools.dart"; import "local_favorites.dart"; @@ -781,7 +782,14 @@ class _ComicsPageViewState extends StateWithController { key: ValueKey(comic.toString()), comic, folder, - rebuild, + () { + rebuild(); + if(widget.selectedComics.contains(comic)) { + var c = StateController.find(); + c.selectedComics.remove(comic); + c.update(); + } + }, true, onTap: () => widget.onClick(comic), onLongPressed: () => widget.onLongPressed(comic),