mirror of
https://github.com/rzuasti/oott.git
synced 2026-07-08 19:21:54 +02:00
Add device detail screen and navigate to it from notifications and devices
- New /devices/:macAddress route showing all device fields with Register/Forget actions - Device list items are now tappable; popup menu gains a "View details" item - Notification list items with a linked device are tappable; popup menu gains a "View device" item - Backend: new DB migration adds optional mac_address column to notifications - Device-related notifications (NewDeviceFound, DeviceOnlineAfterTime, DeviceChanged) now store the triggering device's MAC address Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
07f7d54531
commit
2da339a2b0
@@ -1,6 +1,7 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:infinite_scroll_pagination/infinite_scroll_pagination.dart';
|
||||
|
||||
import '../model/notification.dart' as oott_model;
|
||||
@@ -207,13 +208,20 @@ class _NotificationListState extends State<NotificationList> {
|
||||
trailing: PopupMenuButton<String>(
|
||||
icon: const Icon(Icons.more_vert),
|
||||
onSelected: (value) async {
|
||||
if (value == 'mark_read') {
|
||||
if (value == 'view_device') {
|
||||
context.push('/devices/${item.macAddress}');
|
||||
} else if (value == 'mark_read') {
|
||||
await _markAsRead(context, item);
|
||||
} else if (value == 'mark_new') {
|
||||
await _markAsNew(context, item);
|
||||
}
|
||||
},
|
||||
itemBuilder: (context) => [
|
||||
if (item.macAddress != null)
|
||||
const PopupMenuItem(
|
||||
value: 'view_device',
|
||||
child: Text('View device'),
|
||||
),
|
||||
if (item.isNew)
|
||||
const PopupMenuItem(
|
||||
value: 'mark_read',
|
||||
@@ -226,7 +234,10 @@ class _NotificationListState extends State<NotificationList> {
|
||||
),
|
||||
],
|
||||
),
|
||||
onTap: () {},
|
||||
onTap: item.macAddress != null
|
||||
? () =>
|
||||
context.push('/devices/${item.macAddress}')
|
||||
: null,
|
||||
isThreeLine: true,
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user