Notification Screen and tasq_adaptive_list enhancements

This commit is contained in:
2026-05-11 11:34:34 +08:00
parent 30b301765b
commit e9d1af867a
8 changed files with 499 additions and 165 deletions
+16 -1
View File
@@ -76,6 +76,21 @@ class _NotificationBridgeState extends ConsumerState<NotificationBridge>
}
}
String _bannerLabel(String type) => switch (type) {
'mention' => 'New mention',
'assignment' => 'New assignment',
'created' => 'New item created',
'announcement' => 'New announcement',
'announcement_comment' => 'New announcement comment',
'swap_request' => 'New shift swap request',
'swap_update' => 'Shift swap updated',
'it_job_reminder' => 'IT Job reminder',
'isr_approved' => 'IT Service Request approved',
'isr_status_changed' => 'IT Service Request updated',
'isr_assigned' => 'New IT Service Request assigned',
_ => 'New notification',
};
void _showBanner(String type, NotificationItem item) {
// Use a post-frame callback so that the ScaffoldMessenger from
// MaterialApp is available in the element tree.
@@ -84,7 +99,7 @@ class _NotificationBridgeState extends ConsumerState<NotificationBridge>
try {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text('New $type received!'),
content: Text(_bannerLabel(type)),
action: SnackBarAction(
label: 'View',
onPressed: () =>