From 2bf54099f9a11105dac52e74b1e98175b927da7a Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Sun, 21 Dec 2025 21:57:14 +0800 Subject: [PATCH] :sparkles: Dashboard unread count --- lib/screens/account.dart | 9 ++++++--- lib/screens/dashboard/dash.dart | 11 +++++++++++ 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/lib/screens/account.dart b/lib/screens/account.dart index 2a166bbc..b7842dd0 100644 --- a/lib/screens/account.dart +++ b/lib/screens/account.dart @@ -446,9 +446,12 @@ class AccountScreen extends HookConsumerWidget { child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ - Icon(icon, size: 28), - if (badgeCount != null && badgeCount > 0) - Badge.count(count: badgeCount), + Badge( + isLabelVisible: + badgeCount != null && badgeCount > 0, + label: Text(badgeCount.toString()), + child: Icon(icon, size: 28), + ), ], ), ), diff --git a/lib/screens/dashboard/dash.dart b/lib/screens/dashboard/dash.dart index 992e77eb..18deb064 100644 --- a/lib/screens/dashboard/dash.dart +++ b/lib/screens/dashboard/dash.dart @@ -8,6 +8,7 @@ import 'package:go_router/go_router.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart'; import 'package:island/pods/chat/chat_room.dart'; +import 'package:island/pods/chat/chat_summary.dart'; import 'package:island/pods/event_calendar.dart'; import 'package:island/pods/userinfo.dart'; import 'package:island/screens/chat/chat.dart'; @@ -337,6 +338,7 @@ class NotificationsCard extends HookConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { final notifications = ref.watch(notificationListProvider); + final notificationsUnreadCount = ref.watch(notificationUnreadCountProvider); return Card( margin: EdgeInsets.zero, @@ -373,6 +375,10 @@ class NotificationsCard extends HookConsumerWidget { ), ), ), + Badge.count( + count: notificationsUnreadCount.value ?? 0, + isLabelVisible: (notificationsUnreadCount.value ?? 0) > 0, + ), ], ).padding(horizontal: 16, vertical: 12), notifications.when( @@ -424,6 +430,7 @@ class ChatListCard extends HookConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { final chatRooms = ref.watch(chatRoomJoinedProvider); + final chatUnreadCount = ref.watch(chatUnreadCountProvider); return Card( margin: EdgeInsets.zero, @@ -449,6 +456,10 @@ class ChatListCard extends HookConsumerWidget { ), ), ), + Badge.count( + count: chatUnreadCount.value ?? 0, + isLabelVisible: (chatUnreadCount.value ?? 0) > 0, + ), ], ).padding(horizontal: 16, vertical: 16), chatRooms.when(