绑定设备的位置的更新和获取接口

This commit is contained in:
2026-02-26 08:45:37 +08:00
parent 74632770f5
commit 08d91aa8b1
10 changed files with 118 additions and 5 deletions

View File

@@ -6,12 +6,16 @@ class DevicesState extends Equatable {
final DeviceEntity? selectedDevice; // 当前主界面选中的/操作的设备
final bool isLoading; // 是否正在加载
final String? errorMessage; // 错误信息
final double? deviceLatitude; // 新增字段
final double? deviceLongitude; // 新增字段
const DevicesState({
this.devices = const [],
this.selectedDevice,
this.isLoading = false,
this.errorMessage,
this.deviceLatitude,
this.deviceLongitude,
});
// 使用 copyWith 方便局部更新状态
@@ -20,15 +24,23 @@ class DevicesState extends Equatable {
DeviceEntity? selectedDevice,
bool? isLoading,
String? errorMessage,
double? deviceLatitude,
double? deviceLongitude,
}) {
return DevicesState(
devices: devices ?? this.devices,
selectedDevice: selectedDevice ?? this.selectedDevice,
isLoading: isLoading ?? this.isLoading,
errorMessage: errorMessage, // 错误信息通常每次更新都要重新赋值或清空
deviceLatitude: deviceLatitude ?? this.deviceLatitude,
deviceLongitude: deviceLongitude ?? this.deviceLongitude,
);
}
@override
List<Object?> get props => [devices, selectedDevice, isLoading, errorMessage];
List<Object?> get props => [devices, selectedDevice, isLoading,
errorMessage,
deviceLatitude,
deviceLongitude,
];
}