Mark notification as read when navigating to device

Tapping a notification row or selecting "View device" from the popup
menu now marks the notification as read (if unread) before navigating
to the device detail page.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
rzuasti
2026-05-28 09:26:14 -04:00
co-authored by Claude Sonnet 4.6
parent 22d30a146c
commit e8df0a3980
@@ -211,7 +211,8 @@ class _NotificationListState extends State<NotificationList> {
icon: const Icon(Icons.more_vert),
onSelected: (value) async {
if (value == 'view_device') {
context.push('/devices/${item.macAddress}');
if (item.isNew) await _markAsRead(context, item);
if (context.mounted) context.push('/devices/${item.macAddress}');
} else if (value == 'mark_read') {
await _markAsRead(context, item);
} else if (value == 'mark_new') {
@@ -237,8 +238,10 @@ class _NotificationListState extends State<NotificationList> {
],
),
onTap: item.macAddress != null
? () =>
context.push('/devices/${item.macAddress}')
? () async {
if (item.isNew) await _markAsRead(context, item);
if (context.mounted) context.push('/devices/${item.macAddress}');
}
: null,
isThreeLine: true,
),