mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2026-10-23 15:47:56 +00:00
4scene
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import 'package:syncrow_app/features/devices/model/status_model.dart';
|
||||
|
||||
class FourSceneModel {
|
||||
class FourSceneModelState {
|
||||
dynamic scene_1;
|
||||
dynamic scene_2;
|
||||
dynamic scene_3;
|
||||
@@ -8,7 +8,7 @@ class FourSceneModel {
|
||||
dynamic scene_id_group_id;
|
||||
dynamic switch_backlight;
|
||||
|
||||
FourSceneModel({
|
||||
FourSceneModelState({
|
||||
required this.scene_1,
|
||||
required this.scene_2,
|
||||
required this.scene_3,
|
||||
@@ -17,7 +17,7 @@ class FourSceneModel {
|
||||
required this.switch_backlight,
|
||||
});
|
||||
|
||||
factory FourSceneModel.fromJson(List<StatusModel> jsonList) {
|
||||
factory FourSceneModelState.fromJson(List<StatusModel> jsonList) {
|
||||
late dynamic _scene_1;
|
||||
late dynamic _scene_2;
|
||||
late dynamic _scene_3;
|
||||
@@ -40,7 +40,7 @@ class FourSceneModel {
|
||||
_switch_backlight = jsonList[i].value ?? false;
|
||||
}
|
||||
}
|
||||
return FourSceneModel(
|
||||
return FourSceneModelState(
|
||||
scene_1: _scene_1,
|
||||
scene_2: _scene_2,
|
||||
scene_3: _scene_3,
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
class FourSceneSwitchModel {
|
||||
final String switchName;
|
||||
final DateTime createdAt;
|
||||
final DateTime updatedAt;
|
||||
final String deviceUuid;
|
||||
final Scene scene;
|
||||
|
||||
FourSceneSwitchModel({
|
||||
required this.switchName,
|
||||
required this.createdAt,
|
||||
required this.updatedAt,
|
||||
required this.deviceUuid,
|
||||
required this.scene,
|
||||
});
|
||||
|
||||
factory FourSceneSwitchModel.fromJson(Map<String, dynamic> json) {
|
||||
return FourSceneSwitchModel(
|
||||
switchName: json['switchName'],
|
||||
createdAt: DateTime.parse(json['createdAt']),
|
||||
updatedAt: DateTime.parse(json['updatedAt']),
|
||||
deviceUuid: json['deviceUuid'],
|
||||
scene: Scene.fromJson(json['scene']),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class Scene {
|
||||
final String uuid;
|
||||
final String sceneTuyaId;
|
||||
final String name;
|
||||
final String status;
|
||||
final String icon;
|
||||
final String iconUuid;
|
||||
final bool showInHome;
|
||||
final String type;
|
||||
final List<Action> actions;
|
||||
|
||||
Scene({
|
||||
required this.uuid,
|
||||
required this.sceneTuyaId,
|
||||
required this.name,
|
||||
required this.status,
|
||||
required this.icon,
|
||||
required this.iconUuid,
|
||||
required this.showInHome,
|
||||
required this.type,
|
||||
required this.actions,
|
||||
});
|
||||
|
||||
factory Scene.fromJson(Map<String, dynamic> json) {
|
||||
return Scene(
|
||||
uuid: json['uuid'],
|
||||
sceneTuyaId: json['sceneTuyaId'],
|
||||
name: json['name'],
|
||||
status: json['status'],
|
||||
icon: json['icon'],
|
||||
iconUuid: json['iconUuid'],
|
||||
showInHome: json['showInHome'],
|
||||
type: json['type'],
|
||||
actions: (json['actions'] as List)
|
||||
.map((action) => Action.fromJson(action))
|
||||
.toList(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class Action {
|
||||
final String actionExecutor;
|
||||
final String entityId;
|
||||
final Map<String, dynamic> executorProperty;
|
||||
|
||||
Action({
|
||||
required this.actionExecutor,
|
||||
required this.entityId,
|
||||
required this.executorProperty,
|
||||
});
|
||||
|
||||
factory Action.fromJson(Map<String, dynamic> json) {
|
||||
return Action(
|
||||
actionExecutor: json['actionExecutor'],
|
||||
entityId: json['entityId'],
|
||||
executorProperty: json['executorProperty'],
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user