From c2506fab7a7be7426e5cc1cc210b9a8934cbe764 Mon Sep 17 00:00:00 2001 From: marco Date: Wed, 21 Jan 2026 16:30:30 +0100 Subject: [PATCH 1/3] refactored code so change in bookmark count is visible immediately --- lib/pages/collections_list_page.dart | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/pages/collections_list_page.dart b/lib/pages/collections_list_page.dart index 63f553c..d4c36c6 100644 --- a/lib/pages/collections_list_page.dart +++ b/lib/pages/collections_list_page.dart @@ -21,7 +21,7 @@ class CollectionsListPage extends StatefulWidget { class _CollectionsListPageState extends State { bool addingNewBookmark = false; - final bookmarkCountMap = Storage.loadPerCollectionBookmarkCount(); + var bookmarkCountMap = {}; Widget bottomSheetBuilder(BuildContext context) { final titleTextFieldController = TextEditingController( @@ -84,8 +84,9 @@ class _CollectionsListPageState extends State { @override Widget build(BuildContext context) { final collections = Storage.loadCollections(); - final provider = context.watch(); - addingNewBookmark = provider.currentMapsLinkMetadata != null; + bookmarkCountMap = Storage.loadPerCollectionBookmarkCount(); + addingNewBookmark = + context.watch().currentMapsLinkMetadata != null; return Scaffold( appBar: AppBar( title: addingNewBookmark @@ -94,7 +95,8 @@ class _CollectionsListPageState extends State { actions: [ if (addingNewBookmark) TextButton( - onPressed: () => provider.removeCurrentMapsLink(), + onPressed: () => + context.read().removeCurrentMapsLink(), child: Text(AppLocalizations.of(context)!.cancel), ) else -- 2.49.1 From d0492b2f79d85f9bec853017593ca6f81335d2e0 Mon Sep 17 00:00:00 2001 From: marco Date: Wed, 21 Jan 2026 16:31:43 +0100 Subject: [PATCH 2/3] changed snackbar styling --- lib/service/notifying.dart | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/service/notifying.dart b/lib/service/notifying.dart index 7c4dca1..3d51154 100644 --- a/lib/service/notifying.dart +++ b/lib/service/notifying.dart @@ -10,10 +10,11 @@ class Notifying { }) { ScaffoldMessenger.of(context).showSnackBar( SnackBar( + backgroundColor: Theme.of(context).colorScheme.error, content: Text( text, style: isError - ? TextStyle(color: Theme.of(context).colorScheme.error) + ? TextStyle(color: Theme.of(context).colorScheme.onError) : null, ), ), -- 2.49.1 From 3032e13dc9e299b8ec3eb019681176dfb11307d8 Mon Sep 17 00:00:00 2001 From: marco Date: Wed, 21 Jan 2026 16:37:03 +0100 Subject: [PATCH 3/3] Added dismiss button --- lib/service/notifying.dart | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/lib/service/notifying.dart b/lib/service/notifying.dart index 3d51154..bb8838a 100644 --- a/lib/service/notifying.dart +++ b/lib/service/notifying.dart @@ -8,14 +8,31 @@ class Notifying { required String text, bool isError = false, }) { + ScaffoldMessenger.of(context).hideCurrentSnackBar(); ScaffoldMessenger.of(context).showSnackBar( SnackBar( backgroundColor: Theme.of(context).colorScheme.error, - content: Text( - text, - style: isError - ? TextStyle(color: Theme.of(context).colorScheme.onError) - : null, + content: SizedBox( + height: 30, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + text, + style: isError + ? TextStyle(color: Theme.of(context).colorScheme.onError) + : null, + ), + IconButton( + onPressed: () => + ScaffoldMessenger.of(context).hideCurrentSnackBar(), + icon: Icon( + Icons.close_rounded, + color: Theme.of(context).colorScheme.onError, + ), + ), + ], + ), ), ), ); -- 2.49.1