built 3 gang switch View

This commit is contained in:
Mohammad Salameh
2024-03-14 00:38:00 +03:00
parent 024f15728b
commit 00d1ad50f1
16 changed files with 481 additions and 33 deletions

View File

@ -1,4 +1,5 @@
import 'package:syncrow_app/features/devices/model/device_model.dart';
import 'package:syncrow_app/features/devices/model/function_model.dart';
class ACModel extends DeviceModel {
late double temperature;
@ -23,6 +24,7 @@ class ACModel extends DeviceModel {
required super.status,
required super.image,
required super.timer,
required super.functions,
});
Map<String, dynamic> toJson() {
@ -40,6 +42,12 @@ class ACModel extends DeviceModel {
}
factory ACModel.fromJson(Map<String, dynamic> json) {
List<FunctionModel> func = [];
if (json['functions'] != null) {
json['functions'].forEach((v) {
func.add(FunctionModel.fromJson(v));
});
}
return ACModel(
id: json['id'],
name: json['name'],
@ -52,6 +60,7 @@ class ACModel extends DeviceModel {
timer: json['timer'],
coolTo: json['coolTo'],
bounds: Bounds.fromJson(json['bounds']),
functions: func,
);
}
}