mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-07-15 09:45:22 +00:00
Refactor device name display in RoomPageSwitch widget
This commit is contained in:
@ -259,6 +259,7 @@ mixin SceneOperationsDataHelper {
|
|||||||
for (var condition in conditions) {
|
for (var condition in conditions) {
|
||||||
// Create a dummy Action from Condition to reuse _mapExecutorPropertyToSceneFunction
|
// Create a dummy Action from Condition to reuse _mapExecutorPropertyToSceneFunction
|
||||||
Action dummyAction = Action(
|
Action dummyAction = Action(
|
||||||
|
productType: condition.productType,
|
||||||
actionExecutor: 'device_report',
|
actionExecutor: 'device_report',
|
||||||
entityId: condition.entityId,
|
entityId: condition.entityId,
|
||||||
executorProperty: ExecutorProperty(
|
executorProperty: ExecutorProperty(
|
||||||
@ -833,6 +834,7 @@ mixin SceneOperationsDataHelper {
|
|||||||
|
|
||||||
SceneStaticFunction _createSwitch1Function(Action action, bool isAutomation,
|
SceneStaticFunction _createSwitch1Function(Action action, bool isAutomation,
|
||||||
String? comparator, String? uniqueCustomId) {
|
String? comparator, String? uniqueCustomId) {
|
||||||
|
print('action.productType1=${action.productType}');
|
||||||
switch (action.productType) {
|
switch (action.productType) {
|
||||||
case "3G":
|
case "3G":
|
||||||
return _createSceneFunction(
|
return _createSceneFunction(
|
||||||
@ -858,12 +860,24 @@ mixin SceneOperationsDataHelper {
|
|||||||
comparator,
|
comparator,
|
||||||
uniqueCustomId,
|
uniqueCustomId,
|
||||||
);
|
);
|
||||||
default:
|
case "1G":
|
||||||
return _createSceneFunction(
|
return _createSceneFunction(
|
||||||
action,
|
action,
|
||||||
'1 Gang Button Switch L-L',
|
'1 Gang Button Switch L-L',
|
||||||
Assets.oneGang,
|
Assets.oneGang,
|
||||||
'Light Switch',
|
'Light 1 Switch',
|
||||||
|
OperationDialogType.onOff,
|
||||||
|
_createOnOffOptions(),
|
||||||
|
isAutomation,
|
||||||
|
comparator,
|
||||||
|
uniqueCustomId,
|
||||||
|
);
|
||||||
|
default:
|
||||||
|
return _createSceneFunction(
|
||||||
|
action,
|
||||||
|
'None',
|
||||||
|
Assets.assetsRemoteUnlockReq,
|
||||||
|
'None',
|
||||||
OperationDialogType.onOff,
|
OperationDialogType.onOff,
|
||||||
_createOnOffOptions(),
|
_createOnOffOptions(),
|
||||||
isAutomation,
|
isAutomation,
|
||||||
@ -1434,6 +1448,7 @@ mixin SceneOperationsDataHelper {
|
|||||||
return [
|
return [
|
||||||
_mapExecutorPropertyToSceneFunction(
|
_mapExecutorPropertyToSceneFunction(
|
||||||
Action(
|
Action(
|
||||||
|
productType: '',
|
||||||
entityId: deviceId,
|
entityId: deviceId,
|
||||||
executorProperty: ExecutorProperty(
|
executorProperty: ExecutorProperty(
|
||||||
functionCode: taskItem.code,
|
functionCode: taskItem.code,
|
||||||
|
@ -74,7 +74,7 @@ class Action {
|
|||||||
ExecutorProperty? executorProperty;
|
ExecutorProperty? executorProperty;
|
||||||
String? name;
|
String? name;
|
||||||
String? type;
|
String? type;
|
||||||
String? productType;
|
final String productType;
|
||||||
|
|
||||||
Action({
|
Action({
|
||||||
required this.actionExecutor,
|
required this.actionExecutor,
|
||||||
@ -82,7 +82,7 @@ class Action {
|
|||||||
this.executorProperty,
|
this.executorProperty,
|
||||||
this.name,
|
this.name,
|
||||||
this.type,
|
this.type,
|
||||||
this.productType,
|
required this.productType,
|
||||||
});
|
});
|
||||||
|
|
||||||
String toRawJson() => json.encode(toJson());
|
String toRawJson() => json.encode(toJson());
|
||||||
@ -94,7 +94,7 @@ class Action {
|
|||||||
entityId: json["entityId"] as String,
|
entityId: json["entityId"] as String,
|
||||||
name: json['name'] as String?,
|
name: json['name'] as String?,
|
||||||
type: json['type'] as String?,
|
type: json['type'] as String?,
|
||||||
productType: json['productType'] as String?,
|
productType: json['productType'] as String,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (json["executorProperty"] == null) {
|
if (json["executorProperty"] == null) {
|
||||||
@ -105,7 +105,7 @@ class Action {
|
|||||||
actionExecutor: json["actionExecutor"] as String,
|
actionExecutor: json["actionExecutor"] as String,
|
||||||
entityId: json["entityId"] as String,
|
entityId: json["entityId"] as String,
|
||||||
executorProperty: ExecutorProperty.fromJson(json["executorProperty"]),
|
executorProperty: ExecutorProperty.fromJson(json["executorProperty"]),
|
||||||
productType: json['productType'] as String?,
|
productType: json['productType'] as String,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -146,12 +146,14 @@ class Condition {
|
|||||||
final String entityId;
|
final String entityId;
|
||||||
final String entityType;
|
final String entityType;
|
||||||
final Expr expr;
|
final Expr expr;
|
||||||
|
final String productType;
|
||||||
|
|
||||||
Condition({
|
Condition({
|
||||||
required this.code,
|
required this.code,
|
||||||
required this.entityId,
|
required this.entityId,
|
||||||
required this.entityType,
|
required this.entityType,
|
||||||
required this.expr,
|
required this.expr,
|
||||||
|
required this.productType,
|
||||||
});
|
});
|
||||||
|
|
||||||
factory Condition.fromRawJson(String str) =>
|
factory Condition.fromRawJson(String str) =>
|
||||||
@ -164,6 +166,7 @@ class Condition {
|
|||||||
entityId: json["entityId"],
|
entityId: json["entityId"],
|
||||||
entityType: json["entityType"],
|
entityType: json["entityType"],
|
||||||
expr: Expr.fromJson(json["expr"]),
|
expr: Expr.fromJson(json["expr"]),
|
||||||
|
productType: json['productType'] as String,
|
||||||
);
|
);
|
||||||
|
|
||||||
Map<String, dynamic> toJson() => {
|
Map<String, dynamic> toJson() => {
|
||||||
|
Reference in New Issue
Block a user