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
@@ -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 LightModel extends DeviceModel {
late double brightness;
@@ -19,6 +20,7 @@ class LightModel extends DeviceModel {
required super.status,
required super.image,
required super.timer,
required super.functions,
});
Map<String, dynamic> toJson() {
@@ -37,6 +39,12 @@ class LightModel extends DeviceModel {
}
factory LightModel.fromJson(Map<String, dynamic> json) {
List<FunctionModel> func = [];
if (json['functions'] != null) {
json['functions'].forEach((v) {
func.add(FunctionModel.fromJson(v));
});
}
return LightModel(
id: json['id'],
name: json['name'],
@@ -48,6 +56,7 @@ class LightModel extends DeviceModel {
type: json['type'],
image: json['image'],
recentColors: json['recentColors'],
functions: func,
);
}
}