Skip to content

Commit 339a035

Browse files
committed
feat(account): add hasReadItemsInCurrentTab getter
- Implement a new getter in InAppNotificationCenterState to check for read items in the current tab - This change will help optimize the notification center UI by allowing us to display read/unread status more effectively
1 parent 2d5b61c commit 339a035

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

lib/account/bloc/in_app_notification_center_state.dart

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,16 @@ class InAppNotificationCenterState extends Equatable {
6969
/// The cursor for fetching the next page of digest notifications.
7070
final String? digestCursor;
7171

72+
/// A convenience getter to determine if the current tab has any read items.
73+
bool get hasReadItemsInCurrentTab {
74+
final isBreakingNewsTab = currentTabIndex == 0;
75+
if (isBreakingNewsTab) {
76+
return breakingNewsNotifications.any((n) => n.isRead);
77+
} else {
78+
return digestNotifications.any((n) => n.isRead);
79+
}
80+
}
81+
7282
@override
7383
List<Object> get props => [
7484
status,

0 commit comments

Comments
 (0)