mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2026-10-25 16:07:54 +00:00
built 3 gang switch View
This commit is contained in:
@@ -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,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user