Bug fixes

This commit is contained in:
Abdullah Alassaf
2024-06-30 15:10:01 +03:00
parent 9b37545691
commit 288ea6a1e2
8 changed files with 112 additions and 97 deletions

View File

@ -10,6 +10,7 @@ class DeviceModel {
String? model;
String? name;
String? icon;
String? type;
bool? isOnline;
List<StatusModel> status = [];
String? productName;
@ -19,21 +20,21 @@ class DeviceModel {
DeviceType? productType;
bool isSelected = false;
late List<FunctionModel> functions;
DeviceModel({
this.activeTime,
// this.id,
this.localKey,
this.model,
this.name,
this.isOnline,
required this.status,
this.productName,
this.timeZone,
this.updateTime,
this.uuid,
this.productType,
this.icon,
}) {
DeviceModel(
{this.activeTime,
// this.id,
this.localKey,
this.model,
this.name,
this.isOnline,
required this.status,
this.productName,
this.timeZone,
this.updateTime,
this.uuid,
this.productType,
this.icon,
this.type}) {
functions = getFunctions(productType!);
}
@ -43,8 +44,7 @@ class DeviceModel {
if (type == DeviceType.LightBulb) {
tempIcon = Assets.assetsIconsLight;
} else if (type == DeviceType.CeilingSensor ||
type == DeviceType.WallSensor) {
} else if (type == DeviceType.CeilingSensor || type == DeviceType.WallSensor) {
tempIcon = Assets.assetsIconsSensors;
} else if (type == DeviceType.AC) {
tempIcon = Assets.assetsIconsAC;
@ -72,6 +72,7 @@ class DeviceModel {
updateTime: json['updateTime'],
uuid: json['uuid'],
productType: type,
type: json['productType'],
status: [],
);
}
@ -92,6 +93,5 @@ class DeviceModel {
};
}
List<FunctionModel> getFunctions(DeviceType type) =>
devicesFunctionsMap[productType] ?? [];
List<FunctionModel> getFunctions(DeviceType type) => devicesFunctionsMap[productType] ?? [];
}