mirror of
https://github.com/rzuasti/oott.git
synced 2026-07-08 19:21:54 +02:00
Show registered devices by owner's device type name
Display registered devices with a "John's Laptop" title and move their IP address into the card body, instead of showing the owner separately. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
ef420ad360
commit
2ba51769ec
@@ -340,6 +340,13 @@ class _DeviceCard extends StatelessWidget {
|
|||||||
required this.onRefresh,
|
required this.onRefresh,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
String get _registeredName {
|
||||||
|
final type = device.deviceType == DeviceType.unknown
|
||||||
|
? 'Device'
|
||||||
|
: device.deviceType.label;
|
||||||
|
return "${device.owner}'s $type";
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final theme = Theme.of(context);
|
final theme = Theme.of(context);
|
||||||
@@ -355,7 +362,12 @@ class _DeviceCard extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
title: Row(
|
title: Row(
|
||||||
children: [
|
children: [
|
||||||
Text(device.ipv4Address),
|
Flexible(
|
||||||
|
child: Text(
|
||||||
|
device.isRegistered ? _registeredName : device.ipv4Address,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
),
|
||||||
|
),
|
||||||
const SizedBox(width: 8),
|
const SizedBox(width: 8),
|
||||||
if (device.isRegistered)
|
if (device.isRegistered)
|
||||||
const StatusBadge(label: 'Registered', color: BadgeColor.success)
|
const StatusBadge(label: 'Registered', color: BadgeColor.success)
|
||||||
@@ -367,6 +379,7 @@ class _DeviceCard extends StatelessWidget {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
subtitle: Text(
|
subtitle: Text(
|
||||||
|
'${device.isRegistered ? '${device.ipv4Address}\n' : ''}'
|
||||||
'${device.vendor} · ${device.macAddress}\n'
|
'${device.vendor} · ${device.macAddress}\n'
|
||||||
'Last seen: ${formatter.format(device.lastSeen)}',
|
'Last seen: ${formatter.format(device.lastSeen)}',
|
||||||
),
|
),
|
||||||
@@ -374,7 +387,6 @@ class _DeviceCard extends StatelessWidget {
|
|||||||
trailing: Row(
|
trailing: Row(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
if (device.isRegistered) Text(device.owner),
|
|
||||||
PopupMenuButton<String>(
|
PopupMenuButton<String>(
|
||||||
icon: const Icon(Icons.more_vert),
|
icon: const Icon(Icons.more_vert),
|
||||||
onSelected: (value) async {
|
onSelected: (value) async {
|
||||||
|
|||||||
Reference in New Issue
Block a user