mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-09 22:57:21 +00:00
push add ac fucntions and handle doplicate adding to the then or if items
This commit is contained in:
@ -2,6 +2,8 @@ import 'package:syncrow_web/pages/device_managment/all_devices/models/device_com
|
||||
import 'package:syncrow_web/pages/device_managment/all_devices/models/device_space_model.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/all_devices/models/room.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/all_devices/models/unit.dart';
|
||||
import 'package:syncrow_web/pages/routiens/models/ac/ac_function.dart';
|
||||
import 'package:syncrow_web/pages/routiens/models/device_functions.dart';
|
||||
import 'package:syncrow_web/utils/constants/assets.dart';
|
||||
import 'package:syncrow_web/utils/enum/device_types.dart';
|
||||
|
||||
@ -69,6 +71,7 @@ class AllDevicesModel {
|
||||
int? batteryLevel;
|
||||
String? productName;
|
||||
List<DeviceSpaceModel>? spaces;
|
||||
List<DeviceFunction>? _deviceFunctions;
|
||||
|
||||
AllDevicesModel({
|
||||
this.room,
|
||||
@ -215,6 +218,28 @@ SOS
|
||||
return tempIcon;
|
||||
}
|
||||
|
||||
List<DeviceFunction> get deviceFunctions {
|
||||
_deviceFunctions ??= _getDeviceFunctions();
|
||||
return _deviceFunctions!;
|
||||
}
|
||||
|
||||
List<DeviceFunction> _getDeviceFunctions() {
|
||||
switch (productType) {
|
||||
case 'AC':
|
||||
return [
|
||||
SwitchFunction(deviceId: uuid ?? '', deviceName: name ?? ''),
|
||||
ModeFunction(deviceId: uuid ?? '', deviceName: name ?? ''),
|
||||
TempSetFunction(deviceId: uuid ?? '', deviceName: name ?? ''),
|
||||
LevelFunction(deviceId: uuid ?? '', deviceName: name ?? ''),
|
||||
ChildLockFunction(deviceId: uuid ?? '', deviceName: name ?? ''),
|
||||
];
|
||||
|
||||
// other product types
|
||||
default:
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final data = <String, dynamic>{};
|
||||
if (room != null) {
|
||||
|
Reference in New Issue
Block a user