修改设备别名接口+UI
This commit is contained in:
@@ -1,5 +1,11 @@
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'package:maibu_satabot_v2/features/devices/domain/entities/device_entity.dart';
|
||||
enum DeviceOperationType {
|
||||
none, // 无操作
|
||||
unbind, // 解绑设备
|
||||
updateName, // 修改设备名称
|
||||
}
|
||||
|
||||
|
||||
class DevicesState extends Equatable {
|
||||
final List<DeviceEntity> devices; // 名下所有设备列表
|
||||
@@ -9,6 +15,7 @@ class DevicesState extends Equatable {
|
||||
final double? deviceLatitude; // 新增字段
|
||||
final double? deviceLongitude; // 新增字段
|
||||
final List<Map<String, dynamic>>? workRecords;
|
||||
final DeviceOperationType operationType; // 标记当前操作类型
|
||||
const DevicesState({
|
||||
this.devices = const [],
|
||||
this.selectedDevice,
|
||||
@@ -16,7 +23,8 @@ class DevicesState extends Equatable {
|
||||
this.errorMessage,
|
||||
this.deviceLatitude,
|
||||
this.deviceLongitude,
|
||||
this.workRecords
|
||||
this.workRecords,
|
||||
this.operationType = DeviceOperationType.none, // 默认无操作
|
||||
});
|
||||
|
||||
// 使用 copyWith 方便局部更新状态
|
||||
@@ -28,6 +36,7 @@ class DevicesState extends Equatable {
|
||||
double? deviceLatitude,
|
||||
double? deviceLongitude,
|
||||
List<Map<String, dynamic>>? workRecords,
|
||||
DeviceOperationType? operationType,
|
||||
}) {
|
||||
return DevicesState(
|
||||
devices: devices ?? this.devices,
|
||||
@@ -37,6 +46,7 @@ class DevicesState extends Equatable {
|
||||
deviceLatitude: deviceLatitude ?? this.deviceLatitude,
|
||||
deviceLongitude: deviceLongitude ?? this.deviceLongitude,
|
||||
workRecords: workRecords ?? this.workRecords,
|
||||
operationType: operationType ?? this.operationType, // 更新操作类型
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user