Extract DeviceType as an enum with icon and label getters

Mirrors the NotificationType pattern. Removes duplicated _deviceTypes
list and _deviceIcon() helper from both device screens, centralising
all type-to-icon logic in the model.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
rzuasti
2026-05-27 19:06:09 -04:00
co-authored by Claude Sonnet 4.6
parent 2da339a2b0
commit 1b470fc28f
4 changed files with 66 additions and 98 deletions
+4 -2
View File
@@ -1,3 +1,5 @@
import 'device_type.dart';
class Device {
final String macAddress;
final String ipv4Address;
@@ -5,7 +7,7 @@ class Device {
final DateTime lastSeen;
final bool isRegistered;
final String owner;
final String deviceType;
final DeviceType deviceType;
Device({
required this.macAddress,
@@ -24,5 +26,5 @@ class Device {
lastSeen = DateTime.parse(json['last_seen'] as String),
isRegistered = json['is_registered'] as bool,
owner = json['owner'] as String,
deviceType = json['device_type'] as String;
deviceType = DeviceType.fromString(json['device_type'] as String);
}