mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-10 15:17:31 +00:00
Read icon from fetch scene api
This commit is contained in:
@ -48,8 +48,7 @@ class RoutineDetailsModel {
|
||||
spaceUuid: spaceUuid,
|
||||
automationName: name,
|
||||
decisionExpr: decisionExpr,
|
||||
effectiveTime:
|
||||
effectiveTime ?? EffectiveTime(start: '', end: '', loops: ''),
|
||||
effectiveTime: effectiveTime ?? EffectiveTime(start: '', end: '', loops: ''),
|
||||
conditions: conditions?.map((c) => c.toCondition()).toList() ?? [],
|
||||
actions: actions.map((a) => a.toAutomationAction()).toList(),
|
||||
);
|
||||
@ -64,8 +63,7 @@ class RoutineDetailsModel {
|
||||
if (iconId != null) 'iconUuid': iconId,
|
||||
if (showInDevice != null) 'showInDevice': showInDevice,
|
||||
if (effectiveTime != null) 'effectiveTime': effectiveTime!.toMap(),
|
||||
if (conditions != null)
|
||||
'conditions': conditions!.map((x) => x.toMap()).toList(),
|
||||
if (conditions != null) 'conditions': conditions!.map((x) => x.toMap()).toList(),
|
||||
if (type != null) 'type': type,
|
||||
if (sceneId != null) 'sceneId': sceneId,
|
||||
if (automationId != null) 'automationId': automationId,
|
||||
@ -82,12 +80,10 @@ class RoutineDetailsModel {
|
||||
),
|
||||
iconId: map['iconUuid'],
|
||||
showInDevice: map['showInDevice'],
|
||||
effectiveTime: map['effectiveTime'] != null
|
||||
? EffectiveTime.fromMap(map['effectiveTime'])
|
||||
: null,
|
||||
effectiveTime:
|
||||
map['effectiveTime'] != null ? EffectiveTime.fromMap(map['effectiveTime']) : null,
|
||||
conditions: map['conditions'] != null
|
||||
? List<RoutineCondition>.from(
|
||||
map['conditions'].map((x) => RoutineCondition.fromMap(x)))
|
||||
? List<RoutineCondition>.from(map['conditions'].map((x) => RoutineCondition.fromMap(x)))
|
||||
: null,
|
||||
type: map['type'],
|
||||
sceneId: map['sceneId'],
|
||||
@ -108,15 +104,16 @@ class RoutineAction {
|
||||
final RoutineExecutorProperty? executorProperty;
|
||||
final String productType;
|
||||
final String? type;
|
||||
final String? icon;
|
||||
|
||||
RoutineAction({
|
||||
required this.entityId,
|
||||
required this.actionExecutor,
|
||||
required this.productType,
|
||||
this.executorProperty,
|
||||
this.name,
|
||||
this.type,
|
||||
});
|
||||
RoutineAction(
|
||||
{required this.entityId,
|
||||
required this.actionExecutor,
|
||||
required this.productType,
|
||||
this.executorProperty,
|
||||
this.name,
|
||||
this.type,
|
||||
this.icon});
|
||||
|
||||
CreateSceneAction toCreateSceneAction() {
|
||||
return CreateSceneAction(
|
||||
@ -140,22 +137,21 @@ class RoutineAction {
|
||||
'actionExecutor': actionExecutor,
|
||||
if (type != null) 'type': type,
|
||||
if (name != null) 'name': name,
|
||||
if (executorProperty != null)
|
||||
'executorProperty': executorProperty!.toMap(),
|
||||
if (executorProperty != null) 'executorProperty': executorProperty!.toMap(),
|
||||
};
|
||||
}
|
||||
|
||||
factory RoutineAction.fromMap(Map<String, dynamic> map) {
|
||||
return RoutineAction(
|
||||
entityId: map['entityId'] ?? '',
|
||||
actionExecutor: map['actionExecutor'] ?? '',
|
||||
productType: map['productType'] ?? '',
|
||||
name: map['name'] ?? '',
|
||||
type: map['type'] ?? '',
|
||||
executorProperty: map['executorProperty'] != null
|
||||
? RoutineExecutorProperty.fromMap(map['executorProperty'])
|
||||
: null,
|
||||
);
|
||||
entityId: map['entityId'] ?? '',
|
||||
actionExecutor: map['actionExecutor'] ?? '',
|
||||
productType: map['productType'] ?? '',
|
||||
name: map['name'] ?? '',
|
||||
type: map['type'] ?? '',
|
||||
executorProperty: map['executorProperty'] != null
|
||||
? RoutineExecutorProperty.fromMap(map['executorProperty'])
|
||||
: null,
|
||||
icon: map['icon']);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user