mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2026-03-11 04:21:44 +00:00
Compare commits
17 Commits
SP-1397-FE
...
fix-device
| Author | SHA1 | Date | |
|---|---|---|---|
| 2b0e504f05 | |||
| a656d5981e | |||
| 3f49a18130 | |||
| a51c4d9679 | |||
| caeed8e73f | |||
| dc5ac9be5b | |||
| 5c9b30895f | |||
| 06b14a3964 | |||
| 3c92ea3047 | |||
| 73d28a1800 | |||
| 5493ca6fb0 | |||
| 7005d8ba83 | |||
| cb79627038 | |||
| 1cff69d496 | |||
| 60df77efad | |||
| 9e84048f81 | |||
| 99adb1c286 |
10
assets/icons/cancel_icon.svg
Normal file
10
assets/icons/cancel_icon.svg
Normal file
@ -0,0 +1,10 @@
|
||||
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<g clip-path="url(#clip0_7302_4118)">
|
||||
<path d="M11.1049 10.0001L19.7712 1.33381C20.0763 1.02869 20.0763 0.534007 19.7712 0.228929C19.4661 -0.0761485 18.9714 -0.0761876 18.6663 0.228929L9.99999 8.89524L1.33372 0.228929C1.0286 -0.0761876 0.533915 -0.0761876 0.228837 0.228929C-0.0762401 0.534046 -0.0762792 1.02873 0.228837 1.33381L8.89511 10.0001L0.228837 18.6664C-0.0762792 18.9715 -0.0762792 19.4662 0.228837 19.7713C0.381376 19.9238 0.581337 20.0001 0.781297 20.0001C0.981258 20.0001 1.18118 19.9238 1.33376 19.7713L9.99999 11.105L18.6663 19.7713C18.8188 19.9238 19.0188 20.0001 19.2187 20.0001C19.4187 20.0001 19.6186 19.9238 19.7712 19.7713C20.0763 19.4662 20.0763 18.9715 19.7712 18.6664L11.1049 10.0001Z" fill="#999999"/>
|
||||
</g>
|
||||
<defs>
|
||||
<clipPath id="clip0_7302_4118">
|
||||
<rect width="20" height="20" fill="white"/>
|
||||
</clipPath>
|
||||
</defs>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 939 B |
10
assets/icons/save_routines_icon.svg
Normal file
10
assets/icons/save_routines_icon.svg
Normal file
@ -0,0 +1,10 @@
|
||||
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<g clip-path="url(#clip0_7302_4149)">
|
||||
<path d="M19.9969 4.94279C19.986 4.83232 19.943 4.72146 19.8674 4.62924C19.8382 4.59358 20.1367 4.89431 15.4141 0.17176C15.3015 0.0591838 15.1487 8.30277e-05 14.9996 0.00012209C14.6443 0.00012209 2.11177 0.00012209 1.75779 0.00012209C0.788544 0.00012209 0 0.788666 0 1.75791V18.2421C0 19.2113 0.788544 19.9998 1.75779 19.9998H18.2419C19.2112 19.9998 19.9997 19.2113 19.9997 18.2421C19.9998 4.01624 20.0013 4.98771 19.9969 4.94279ZM13.4764 1.17198V5.00005C13.4764 5.32314 13.2136 5.58598 12.8905 5.58598H12.1483V1.17198H13.4764ZM10.9765 1.17198V5.58598H5.54684C5.22376 5.58598 4.96091 5.32314 4.96091 5.00005V1.17198H10.9765ZM13.4764 12.539H4.96091V11.7968C4.96091 11.4738 5.22376 11.2109 5.54684 11.2109H12.8905C13.2136 11.2109 13.4764 11.4738 13.4764 11.7968V12.539ZM4.96091 18.828V13.7109H13.4764V18.828H4.96091ZM18.8279 18.2421C18.8279 18.5651 18.5651 18.828 18.242 18.828H14.6483C14.6483 18.0641 14.6483 12.6676 14.6483 11.7968C14.6483 10.8276 13.8597 10.039 12.8905 10.039H5.54684C4.57759 10.039 3.78905 10.8276 3.78905 11.7968V18.828H1.75783C1.43475 18.828 1.1719 18.5651 1.1719 18.2421V1.75791C1.1719 1.43483 1.43475 1.17198 1.75783 1.17198H3.78905V5.00005C3.78905 5.9693 4.57759 6.75784 5.54684 6.75784H12.8905C13.8597 6.75784 14.6483 5.9693 14.6483 5.00005V1.17198H14.7571L18.8279 5.24278V18.2421Z" fill="#023DFE" fill-opacity="0.6"/>
|
||||
</g>
|
||||
<defs>
|
||||
<clipPath id="clip0_7302_4149">
|
||||
<rect width="20" height="20" fill="white"/>
|
||||
</clipPath>
|
||||
</defs>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.6 KiB |
@ -169,18 +169,20 @@ class DeviceManagerBloc extends Bloc<DeviceManagerEvent, DeviceManagerState> {
|
||||
}
|
||||
}
|
||||
|
||||
_getOnlyImplementedDevices(List<DeviceModel> devices) {
|
||||
List<DeviceModel> implementedDevices = [];
|
||||
for (int i = 0; i < devices.length; i++) {
|
||||
if (devices[i].productType == DeviceType.AC ||
|
||||
devices[i].productType == DeviceType.DoorLock ||
|
||||
devices[i].productType == DeviceType.Gateway ||
|
||||
devices[i].productType == DeviceType.WallSensor ||
|
||||
devices[i].productType == DeviceType.CeilingSensor ||
|
||||
devices[i].productType == DeviceType.ThreeGang) {
|
||||
implementedDevices.add(devices[i]);
|
||||
}
|
||||
}
|
||||
return implementedDevices;
|
||||
List<DeviceModel> _getOnlyImplementedDevices(List<DeviceModel> devices) {
|
||||
const allowedDeviceTypes = {
|
||||
DeviceType.AC,
|
||||
DeviceType.DoorLock,
|
||||
DeviceType.Gateway,
|
||||
DeviceType.WallSensor,
|
||||
DeviceType.CeilingSensor,
|
||||
DeviceType.ThreeGang,
|
||||
DeviceType.OneGang,
|
||||
DeviceType.TwoGang
|
||||
};
|
||||
|
||||
return devices
|
||||
.where((device) => allowedDeviceTypes.contains(device.productType))
|
||||
.toList();
|
||||
}
|
||||
}
|
||||
|
||||
@ -76,21 +76,38 @@ class RoomPageSwitch extends StatelessWidget {
|
||||
: const SizedBox(),
|
||||
],
|
||||
),
|
||||
Flexible(
|
||||
child: FittedBox(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
device.name ?? "",
|
||||
overflow: TextOverflow.ellipsis,
|
||||
maxLines: 2,
|
||||
LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
final text = device.name ?? "";
|
||||
final textPainter = TextPainter(
|
||||
text: TextSpan(
|
||||
text: text,
|
||||
style: context.bodyLarge.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 20,
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
maxLines: 1,
|
||||
textDirection: TextDirection.ltr,
|
||||
);
|
||||
|
||||
textPainter.layout(maxWidth: constraints.maxWidth);
|
||||
|
||||
final exceeded = textPainter.didExceedMaxLines;
|
||||
|
||||
return Text(
|
||||
exceeded ? '${text.substring(0, 10)}...' : text,
|
||||
style: context.bodyLarge.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 20,
|
||||
color: Colors.grey,
|
||||
),
|
||||
overflow: TextOverflow.clip,
|
||||
maxLines: 1,
|
||||
);
|
||||
},
|
||||
),
|
||||
Text(
|
||||
device.subspace!.subspaceName ?? '',
|
||||
overflow: TextOverflow.ellipsis,
|
||||
@ -103,10 +120,6 @@ class RoomPageSwitch extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -119,7 +132,6 @@ Future<void> showDeviceInterface(
|
||||
required BuildContext context,
|
||||
required isAllDevices,
|
||||
List<DeviceModel>? allDevices}) async {
|
||||
print('object-----${device.uuid} ${device.name}');
|
||||
|
||||
final devicesCubit = context.read<DevicesCubit>();
|
||||
|
||||
|
||||
@ -0,0 +1,78 @@
|
||||
import 'package:syncrow_app/features/scene/enum/operation_dialog_type.dart';
|
||||
import 'package:syncrow_app/features/scene/model/scene_static_function.dart';
|
||||
import 'package:syncrow_app/generated/assets.dart';
|
||||
|
||||
class OneGangHelperFunctions {
|
||||
static List<SceneStaticFunction> oneGangHelperFunctions(
|
||||
String deviceId, String deviceName, functionValue) {
|
||||
return [
|
||||
SceneStaticFunction(
|
||||
deviceId: deviceId,
|
||||
deviceName: deviceName,
|
||||
icon: Assets.assetsAcPower,
|
||||
operationName: 'Light Switch',
|
||||
code: 'switch_1',
|
||||
functionValue: functionValue,
|
||||
operationDialogType: OperationDialogType.onOff,
|
||||
operationalValues: [
|
||||
SceneOperationalValue(
|
||||
icon: Assets.assetsAcPower, description: "ON", value: true),
|
||||
SceneOperationalValue(
|
||||
icon: Assets.assetsAcPowerOFF, description: "OFF", value: false),
|
||||
],
|
||||
),
|
||||
SceneStaticFunction(
|
||||
deviceId: deviceId,
|
||||
deviceName: deviceName,
|
||||
icon: Assets.assetsLightCountdown,
|
||||
operationName: 'Light CountDown',
|
||||
code: 'countdown_1',
|
||||
functionValue: functionValue,
|
||||
operationDialogType: OperationDialogType.countdown,
|
||||
operationalValues: [
|
||||
SceneOperationalValue(icon: '', value: 0),
|
||||
],
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
static List<SceneStaticFunction> oneGangAutomationFunctions(
|
||||
String deviceId, String deviceName, functionValue) {
|
||||
return [
|
||||
SceneStaticFunction(
|
||||
deviceId: deviceId,
|
||||
deviceName: deviceName,
|
||||
icon: Assets.assetsAcPower,
|
||||
operationName: 'Light Switch',
|
||||
code: 'switch_1',
|
||||
functionValue: functionValue,
|
||||
operationDialogType: OperationDialogType.onOff,
|
||||
operationalValues: [
|
||||
SceneOperationalValue(
|
||||
icon: Assets.assetsAcPower, description: "ON", value: true),
|
||||
SceneOperationalValue(
|
||||
icon: Assets.assetsAcPowerOFF, description: "OFF", value: false),
|
||||
],
|
||||
),
|
||||
SceneStaticFunction(
|
||||
deviceId: deviceId,
|
||||
deviceName: deviceName,
|
||||
icon: Assets.assetsLightCountdown,
|
||||
operationName: 'Light CountDown',
|
||||
code: 'countdown_1',
|
||||
functionValue: functionValue,
|
||||
operationDialogType: OperationDialogType.integerSteps,
|
||||
operationalValues: [
|
||||
SceneOperationalValue(
|
||||
icon: '',
|
||||
description: "sec",
|
||||
value: 0.0,
|
||||
minValue: 0,
|
||||
maxValue: 43200,
|
||||
stepValue: 1,
|
||||
),
|
||||
],
|
||||
),
|
||||
];
|
||||
}
|
||||
}
|
||||
@ -10,7 +10,7 @@ class ThreeGangHelperFunctions {
|
||||
deviceId: deviceId,
|
||||
deviceName: deviceName,
|
||||
icon: Assets.assetsAcPower,
|
||||
operationName: 'Light 1 Switch',
|
||||
operationName: 'L - Light Switch',
|
||||
code: 'switch_1',
|
||||
functionValue: functionValue,
|
||||
operationDialogType: OperationDialogType.onOff,
|
||||
@ -21,11 +21,23 @@ class ThreeGangHelperFunctions {
|
||||
icon: Assets.assetsAcPowerOFF, description: "OFF", value: false),
|
||||
],
|
||||
),
|
||||
SceneStaticFunction(
|
||||
deviceId: deviceId,
|
||||
deviceName: deviceName,
|
||||
icon: Assets.assetsLightCountdown,
|
||||
operationName: 'L - Light Countdown',
|
||||
code: 'countdown_1',
|
||||
functionValue: functionValue,
|
||||
operationDialogType: OperationDialogType.countdown,
|
||||
operationalValues: [
|
||||
SceneOperationalValue(icon: '', value: 0),
|
||||
],
|
||||
),
|
||||
SceneStaticFunction(
|
||||
deviceId: deviceId,
|
||||
deviceName: deviceName,
|
||||
icon: Assets.assetsAcPower,
|
||||
operationName: 'Light 2 Switch',
|
||||
operationName: 'M - Light Switch',
|
||||
code: 'switch_2',
|
||||
functionValue: functionValue,
|
||||
operationDialogType: OperationDialogType.onOff,
|
||||
@ -36,11 +48,23 @@ class ThreeGangHelperFunctions {
|
||||
icon: Assets.assetsAcPowerOFF, description: "OFF", value: false),
|
||||
],
|
||||
),
|
||||
SceneStaticFunction(
|
||||
deviceId: deviceId,
|
||||
deviceName: deviceName,
|
||||
icon: Assets.assetsLightCountdown,
|
||||
operationName: 'M - Light Countdown',
|
||||
code: 'countdown_2',
|
||||
functionValue: functionValue,
|
||||
operationDialogType: OperationDialogType.countdown,
|
||||
operationalValues: [
|
||||
SceneOperationalValue(icon: '', value: 0),
|
||||
],
|
||||
),
|
||||
SceneStaticFunction(
|
||||
deviceId: deviceId,
|
||||
deviceName: deviceName,
|
||||
icon: Assets.assetsAcPower,
|
||||
operationName: 'Light 3 Switch',
|
||||
operationName: 'R - Light Switch',
|
||||
code: 'switch_3',
|
||||
functionValue: functionValue,
|
||||
operationDialogType: OperationDialogType.onOff,
|
||||
@ -55,31 +79,7 @@ class ThreeGangHelperFunctions {
|
||||
deviceId: deviceId,
|
||||
deviceName: deviceName,
|
||||
icon: Assets.assetsLightCountdown,
|
||||
operationName: 'Light 1 CountDown',
|
||||
code: 'countdown_1',
|
||||
functionValue: functionValue,
|
||||
operationDialogType: OperationDialogType.countdown,
|
||||
operationalValues: [
|
||||
SceneOperationalValue(icon: '', value: 0),
|
||||
],
|
||||
),
|
||||
SceneStaticFunction(
|
||||
deviceId: deviceId,
|
||||
deviceName: deviceName,
|
||||
icon: Assets.assetsLightCountdown,
|
||||
operationName: 'Light 2 CountDown',
|
||||
code: 'countdown_2',
|
||||
functionValue: functionValue,
|
||||
operationDialogType: OperationDialogType.countdown,
|
||||
operationalValues: [
|
||||
SceneOperationalValue(icon: '', value: 0),
|
||||
],
|
||||
),
|
||||
SceneStaticFunction(
|
||||
deviceId: deviceId,
|
||||
deviceName: deviceName,
|
||||
icon: Assets.assetsLightCountdown,
|
||||
operationName: 'Light 3 CountDown',
|
||||
operationName: 'R - Light Countdown',
|
||||
code: 'countdown_3',
|
||||
functionValue: functionValue,
|
||||
operationDialogType: OperationDialogType.countdown,
|
||||
@ -97,7 +97,7 @@ class ThreeGangHelperFunctions {
|
||||
deviceId: deviceId,
|
||||
deviceName: deviceName,
|
||||
icon: Assets.assetsAcPower,
|
||||
operationName: 'Light 1 Switch',
|
||||
operationName: 'L - Light Switch',
|
||||
code: 'switch_1',
|
||||
functionValue: functionValue,
|
||||
operationDialogType: OperationDialogType.onOff,
|
||||
@ -108,41 +108,11 @@ class ThreeGangHelperFunctions {
|
||||
icon: Assets.assetsAcPowerOFF, description: "OFF", value: false),
|
||||
],
|
||||
),
|
||||
SceneStaticFunction(
|
||||
deviceId: deviceId,
|
||||
deviceName: deviceName,
|
||||
icon: Assets.assetsAcPower,
|
||||
operationName: 'Light 2 Switch',
|
||||
code: 'switch_2',
|
||||
functionValue: functionValue,
|
||||
operationDialogType: OperationDialogType.onOff,
|
||||
operationalValues: [
|
||||
SceneOperationalValue(
|
||||
icon: Assets.assetsAcPower, description: "ON", value: true),
|
||||
SceneOperationalValue(
|
||||
icon: Assets.assetsAcPowerOFF, description: "OFF", value: false),
|
||||
],
|
||||
),
|
||||
SceneStaticFunction(
|
||||
deviceId: deviceId,
|
||||
deviceName: deviceName,
|
||||
icon: Assets.assetsAcPower,
|
||||
operationName: 'Light 3 Switch',
|
||||
code: 'switch_3',
|
||||
functionValue: functionValue,
|
||||
operationDialogType: OperationDialogType.onOff,
|
||||
operationalValues: [
|
||||
SceneOperationalValue(
|
||||
icon: Assets.assetsAcPower, description: "ON", value: true),
|
||||
SceneOperationalValue(
|
||||
icon: Assets.assetsAcPowerOFF, description: "OFF", value: false),
|
||||
],
|
||||
),
|
||||
SceneStaticFunction(
|
||||
deviceId: deviceId,
|
||||
deviceName: deviceName,
|
||||
icon: Assets.assetsLightCountdown,
|
||||
operationName: 'Light 1 CountDown',
|
||||
operationName: 'L - Light Countdown',
|
||||
code: 'countdown_1',
|
||||
functionValue: functionValue,
|
||||
operationDialogType: OperationDialogType.integerSteps,
|
||||
@ -157,11 +127,26 @@ class ThreeGangHelperFunctions {
|
||||
),
|
||||
],
|
||||
),
|
||||
SceneStaticFunction(
|
||||
deviceId: deviceId,
|
||||
deviceName: deviceName,
|
||||
icon: Assets.assetsAcPower,
|
||||
operationName: 'M - Light Switch',
|
||||
code: 'switch_2',
|
||||
functionValue: functionValue,
|
||||
operationDialogType: OperationDialogType.onOff,
|
||||
operationalValues: [
|
||||
SceneOperationalValue(
|
||||
icon: Assets.assetsAcPower, description: "ON", value: true),
|
||||
SceneOperationalValue(
|
||||
icon: Assets.assetsAcPowerOFF, description: "OFF", value: false),
|
||||
],
|
||||
),
|
||||
SceneStaticFunction(
|
||||
deviceId: deviceId,
|
||||
deviceName: deviceName,
|
||||
icon: Assets.assetsLightCountdown,
|
||||
operationName: 'Light 2 CountDown',
|
||||
operationName: 'M - Light Countdown',
|
||||
code: 'countdown_2',
|
||||
functionValue: functionValue,
|
||||
operationDialogType: OperationDialogType.integerSteps,
|
||||
@ -176,11 +161,26 @@ class ThreeGangHelperFunctions {
|
||||
),
|
||||
],
|
||||
),
|
||||
SceneStaticFunction(
|
||||
deviceId: deviceId,
|
||||
deviceName: deviceName,
|
||||
icon: Assets.assetsAcPower,
|
||||
operationName: 'R - Light Switch',
|
||||
code: 'switch_3',
|
||||
functionValue: functionValue,
|
||||
operationDialogType: OperationDialogType.onOff,
|
||||
operationalValues: [
|
||||
SceneOperationalValue(
|
||||
icon: Assets.assetsAcPower, description: "ON", value: true),
|
||||
SceneOperationalValue(
|
||||
icon: Assets.assetsAcPowerOFF, description: "OFF", value: false),
|
||||
],
|
||||
),
|
||||
SceneStaticFunction(
|
||||
deviceId: deviceId,
|
||||
deviceName: deviceName,
|
||||
icon: Assets.assetsLightCountdown,
|
||||
operationName: 'Light 3 CountDown',
|
||||
operationName: 'R - Light Countdown',
|
||||
code: 'countdown_3',
|
||||
functionValue: functionValue,
|
||||
operationDialogType: OperationDialogType.integerSteps,
|
||||
|
||||
@ -0,0 +1,139 @@
|
||||
import 'package:syncrow_app/features/scene/enum/operation_dialog_type.dart';
|
||||
import 'package:syncrow_app/features/scene/model/scene_static_function.dart';
|
||||
import 'package:syncrow_app/generated/assets.dart';
|
||||
|
||||
class TowGangHelperFunctions {
|
||||
static List<SceneStaticFunction> towGangHelperFunctions(
|
||||
String deviceId, String deviceName, functionValue) {
|
||||
return [
|
||||
SceneStaticFunction(
|
||||
deviceId: deviceId,
|
||||
deviceName: deviceName,
|
||||
icon: Assets.assetsAcPower,
|
||||
operationName: 'L - Light Switch',
|
||||
code: 'switch_1',
|
||||
functionValue: functionValue,
|
||||
operationDialogType: OperationDialogType.onOff,
|
||||
operationalValues: [
|
||||
SceneOperationalValue(
|
||||
icon: Assets.assetsAcPower, description: "ON", value: true),
|
||||
SceneOperationalValue(
|
||||
icon: Assets.assetsAcPowerOFF, description: "OFF", value: false),
|
||||
],
|
||||
),
|
||||
SceneStaticFunction(
|
||||
deviceId: deviceId,
|
||||
deviceName: deviceName,
|
||||
icon: Assets.assetsLightCountdown,
|
||||
operationName: 'L - Light CountDown',
|
||||
code: 'countdown_1',
|
||||
functionValue: functionValue,
|
||||
operationDialogType: OperationDialogType.countdown,
|
||||
operationalValues: [
|
||||
SceneOperationalValue(icon: '', value: 0),
|
||||
],
|
||||
),
|
||||
SceneStaticFunction(
|
||||
deviceId: deviceId,
|
||||
deviceName: deviceName,
|
||||
icon: Assets.assetsAcPower,
|
||||
operationName: 'R - Light Switch',
|
||||
code: 'switch_2',
|
||||
functionValue: functionValue,
|
||||
operationDialogType: OperationDialogType.onOff,
|
||||
operationalValues: [
|
||||
SceneOperationalValue(
|
||||
icon: Assets.assetsAcPower, description: "ON", value: true),
|
||||
SceneOperationalValue(
|
||||
icon: Assets.assetsAcPowerOFF, description: "OFF", value: false),
|
||||
],
|
||||
),
|
||||
SceneStaticFunction(
|
||||
deviceId: deviceId,
|
||||
deviceName: deviceName,
|
||||
icon: Assets.assetsLightCountdown,
|
||||
operationName: 'R - Light CountDown',
|
||||
code: 'countdown_2',
|
||||
functionValue: functionValue,
|
||||
operationDialogType: OperationDialogType.countdown,
|
||||
operationalValues: [
|
||||
SceneOperationalValue(icon: '', value: 0),
|
||||
],
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
static List<SceneStaticFunction> towGangAutomationFunctions(
|
||||
String deviceId, String deviceName, functionValue) {
|
||||
return [
|
||||
SceneStaticFunction(
|
||||
deviceId: deviceId,
|
||||
deviceName: deviceName,
|
||||
icon: Assets.assetsAcPower,
|
||||
operationName: 'L - Light Switch',
|
||||
code: 'switch_1',
|
||||
functionValue: functionValue,
|
||||
operationDialogType: OperationDialogType.onOff,
|
||||
operationalValues: [
|
||||
SceneOperationalValue(
|
||||
icon: Assets.assetsAcPower, description: "ON", value: true),
|
||||
SceneOperationalValue(
|
||||
icon: Assets.assetsAcPowerOFF, description: "OFF", value: false),
|
||||
],
|
||||
),
|
||||
SceneStaticFunction(
|
||||
deviceId: deviceId,
|
||||
deviceName: deviceName,
|
||||
icon: Assets.assetsLightCountdown,
|
||||
operationName: 'R - Light CountDown',
|
||||
code: 'countdown_1',
|
||||
functionValue: functionValue,
|
||||
operationDialogType: OperationDialogType.integerSteps,
|
||||
operationalValues: [
|
||||
SceneOperationalValue(
|
||||
icon: '',
|
||||
description: "sec",
|
||||
value: 0.0,
|
||||
minValue: 0,
|
||||
maxValue: 43200,
|
||||
stepValue: 1,
|
||||
),
|
||||
],
|
||||
),
|
||||
SceneStaticFunction(
|
||||
deviceId: deviceId,
|
||||
deviceName: deviceName,
|
||||
icon: Assets.assetsAcPower,
|
||||
operationName: 'R - Light Switch',
|
||||
code: 'switch_2',
|
||||
functionValue: functionValue,
|
||||
operationDialogType: OperationDialogType.onOff,
|
||||
operationalValues: [
|
||||
SceneOperationalValue(
|
||||
icon: Assets.assetsAcPower, description: "ON", value: true),
|
||||
SceneOperationalValue(
|
||||
icon: Assets.assetsAcPowerOFF, description: "OFF", value: false),
|
||||
],
|
||||
),
|
||||
SceneStaticFunction(
|
||||
deviceId: deviceId,
|
||||
deviceName: deviceName,
|
||||
icon: Assets.assetsLightCountdown,
|
||||
operationName: 'R - Light CountDown',
|
||||
code: 'countdown_2',
|
||||
functionValue: functionValue,
|
||||
operationDialogType: OperationDialogType.integerSteps,
|
||||
operationalValues: [
|
||||
SceneOperationalValue(
|
||||
icon: '',
|
||||
description: "sec",
|
||||
value: 0.0,
|
||||
minValue: 0,
|
||||
maxValue: 43200,
|
||||
stepValue: 1,
|
||||
),
|
||||
],
|
||||
),
|
||||
];
|
||||
}
|
||||
}
|
||||
@ -6,16 +6,19 @@ import 'package:syncrow_app/features/scene/helper/functions_per_device/ac_functi
|
||||
import 'package:syncrow_app/features/scene/helper/functions_per_device/door_lock_functions.dart';
|
||||
import 'package:syncrow_app/features/scene/helper/functions_per_device/gateway_functions.dart';
|
||||
import 'package:syncrow_app/features/scene/helper/functions_per_device/human_presence_functions.dart';
|
||||
import 'package:syncrow_app/features/scene/helper/functions_per_device/one_gang_functions.dart';
|
||||
import 'package:syncrow_app/features/scene/helper/functions_per_device/presence_sensor.dart';
|
||||
import 'package:syncrow_app/features/scene/helper/functions_per_device/three_gang_functions.dart';
|
||||
import 'package:syncrow_app/features/scene/helper/functions_per_device/tow_gang_helper_functions.dart';
|
||||
import 'package:syncrow_app/features/scene/model/scene_details_model.dart';
|
||||
import 'package:syncrow_app/features/scene/model/scene_static_function.dart';
|
||||
import 'package:syncrow_app/generated/assets.dart';
|
||||
import 'package:syncrow_app/utils/resource_manager/constants.dart';
|
||||
|
||||
mixin SceneOperationsDataHelper {
|
||||
final Map<DeviceType, Function(List<FunctionModel>, String, String, dynamic, bool)> _functionMap =
|
||||
{
|
||||
final Map<DeviceType,
|
||||
Function(List<FunctionModel>, String, String, dynamic, bool)>
|
||||
_functionMap = {
|
||||
DeviceType.LightBulb: lightBulbFunctions,
|
||||
DeviceType.CeilingSensor: ceilingSensorFunctions,
|
||||
DeviceType.WallSensor: wallSensorFunctions,
|
||||
@ -24,6 +27,8 @@ mixin SceneOperationsDataHelper {
|
||||
DeviceType.Curtain: curtainFunctions,
|
||||
DeviceType.ThreeGang: threeGangFunctions,
|
||||
DeviceType.Gateway: gatewayFunctions,
|
||||
DeviceType.OneGang: oneGangFunctions,
|
||||
DeviceType.TwoGang: towGangFunctions,
|
||||
};
|
||||
|
||||
final Map<DeviceType, String> _titleMap = {
|
||||
@ -35,8 +40,39 @@ mixin SceneOperationsDataHelper {
|
||||
DeviceType.Curtain: 'Curtain Functions',
|
||||
DeviceType.ThreeGang: '3G Light Switch Functions',
|
||||
DeviceType.Gateway: 'Gateway Functions',
|
||||
DeviceType.OneGang: '1G Light Switch Conditions',
|
||||
DeviceType.TwoGang: '2G Light Switch Conditions',
|
||||
};
|
||||
|
||||
//one gang functions
|
||||
static List<SceneStaticFunction> oneGangFunctions(
|
||||
List<FunctionModel> functions,
|
||||
String deviceId,
|
||||
String deviceName,
|
||||
dynamic functionValue,
|
||||
bool isAutomation) {
|
||||
if (isAutomation) {
|
||||
return OneGangHelperFunctions.oneGangAutomationFunctions(
|
||||
deviceId, deviceName, functionValue);
|
||||
}
|
||||
return OneGangHelperFunctions.oneGangHelperFunctions(
|
||||
deviceId, deviceName, functionValue);
|
||||
}
|
||||
|
||||
static List<SceneStaticFunction> towGangFunctions(
|
||||
List<FunctionModel> functions,
|
||||
String deviceId,
|
||||
String deviceName,
|
||||
dynamic functionValue,
|
||||
bool isAutomation) {
|
||||
if (isAutomation) {
|
||||
return TowGangHelperFunctions.towGangAutomationFunctions(
|
||||
deviceId, deviceName, functionValue);
|
||||
}
|
||||
return TowGangHelperFunctions.towGangHelperFunctions(
|
||||
deviceId, deviceName, functionValue);
|
||||
}
|
||||
|
||||
List<SceneStaticFunction> getFunctionsWithIcons({
|
||||
DeviceType? type,
|
||||
required List<FunctionModel> functions,
|
||||
@ -45,16 +81,22 @@ mixin SceneOperationsDataHelper {
|
||||
required bool isAutomation,
|
||||
}) {
|
||||
final functionValue = null;
|
||||
return _functionMap[type]?.call(functions, deviceId, deviceName, functionValue, isAutomation) ??
|
||||
lightBulbFunctions(functions, deviceId, deviceName, functionValue, isAutomation);
|
||||
return _functionMap[type]?.call(
|
||||
functions, deviceId, deviceName, functionValue, isAutomation) ??
|
||||
lightBulbFunctions(
|
||||
functions, deviceId, deviceName, functionValue, isAutomation);
|
||||
}
|
||||
|
||||
String getTitle({DeviceType? type}) {
|
||||
return _titleMap[type] ?? '';
|
||||
}
|
||||
|
||||
static List<SceneStaticFunction> ceilingSensorFunctions(List<FunctionModel> functions,
|
||||
String deviceId, String deviceName, dynamic functionValue, bool isAutomation) {
|
||||
static List<SceneStaticFunction> ceilingSensorFunctions(
|
||||
List<FunctionModel> functions,
|
||||
String deviceId,
|
||||
String deviceName,
|
||||
dynamic functionValue,
|
||||
bool isAutomation) {
|
||||
if (isAutomation) {
|
||||
return PresenceSensorHelperFunctions.automationPresenceSensorFunctions(
|
||||
deviceId, deviceName, functionValue);
|
||||
@ -63,22 +105,35 @@ mixin SceneOperationsDataHelper {
|
||||
deviceId, deviceName, functionValue);
|
||||
}
|
||||
|
||||
static List<SceneStaticFunction> curtainFunctions(List<FunctionModel> functions, String deviceId,
|
||||
String deviceName, dynamic functionValue, bool isAutomation) {
|
||||
static List<SceneStaticFunction> curtainFunctions(
|
||||
List<FunctionModel> functions,
|
||||
String deviceId,
|
||||
String deviceName,
|
||||
dynamic functionValue,
|
||||
bool isAutomation) {
|
||||
return [];
|
||||
}
|
||||
|
||||
static List<SceneStaticFunction> doorLockFunctions(List<FunctionModel> functions, String deviceId,
|
||||
String deviceName, dynamic functionValue, bool isAutomation) {
|
||||
static List<SceneStaticFunction> doorLockFunctions(
|
||||
List<FunctionModel> functions,
|
||||
String deviceId,
|
||||
String deviceName,
|
||||
dynamic functionValue,
|
||||
bool isAutomation) {
|
||||
if (isAutomation) {
|
||||
return DoorLockHelperFunctions.doorLockAutomationFunctions(
|
||||
deviceId, deviceName, functionValue);
|
||||
}
|
||||
return DoorLockHelperFunctions.doorLockTapToRunFunctions(deviceId, deviceName, functionValue);
|
||||
return DoorLockHelperFunctions.doorLockTapToRunFunctions(
|
||||
deviceId, deviceName, functionValue);
|
||||
}
|
||||
|
||||
static List<SceneStaticFunction> wallSensorFunctions(List<FunctionModel> functions,
|
||||
String deviceId, String deviceName, dynamic functionValue, bool isAutomation) {
|
||||
static List<SceneStaticFunction> wallSensorFunctions(
|
||||
List<FunctionModel> functions,
|
||||
String deviceId,
|
||||
String deviceName,
|
||||
dynamic functionValue,
|
||||
bool isAutomation) {
|
||||
if (isAutomation) {
|
||||
return HumanPresenceHelperFunctions.automationHumanPresenceFunctions(
|
||||
deviceId, deviceName, functionValue);
|
||||
@ -87,31 +142,51 @@ mixin SceneOperationsDataHelper {
|
||||
deviceId, deviceName, functionValue);
|
||||
}
|
||||
|
||||
static List<SceneStaticFunction> lightBulbFunctions(List<FunctionModel> functions,
|
||||
String deviceId, String deviceName, dynamic functionValue, bool isAutomation) {
|
||||
static List<SceneStaticFunction> lightBulbFunctions(
|
||||
List<FunctionModel> functions,
|
||||
String deviceId,
|
||||
String deviceName,
|
||||
dynamic functionValue,
|
||||
bool isAutomation) {
|
||||
return [];
|
||||
}
|
||||
|
||||
static List<SceneStaticFunction> gatewayFunctions(List<FunctionModel> functions, String deviceId,
|
||||
String deviceName, dynamic functionValue, bool isAutomation) {
|
||||
return GatewayHelperFunctions.tabToRunGatewayFunctions(deviceId, deviceName, functionValue);
|
||||
static List<SceneStaticFunction> gatewayFunctions(
|
||||
List<FunctionModel> functions,
|
||||
String deviceId,
|
||||
String deviceName,
|
||||
dynamic functionValue,
|
||||
bool isAutomation) {
|
||||
return GatewayHelperFunctions.tabToRunGatewayFunctions(
|
||||
deviceId, deviceName, functionValue);
|
||||
}
|
||||
|
||||
static List<SceneStaticFunction> threeGangFunctions(List<FunctionModel> functions,
|
||||
String deviceId, String deviceName, dynamic functionValue, bool isAutomation) {
|
||||
static List<SceneStaticFunction> threeGangFunctions(
|
||||
List<FunctionModel> functions,
|
||||
String deviceId,
|
||||
String deviceName,
|
||||
dynamic functionValue,
|
||||
bool isAutomation) {
|
||||
if (isAutomation) {
|
||||
return ThreeGangHelperFunctions.threeGangAutomationFunctions(
|
||||
deviceId, deviceName, functionValue);
|
||||
}
|
||||
return ThreeGangHelperFunctions.threeGangHelperFunctions(deviceId, deviceName, functionValue);
|
||||
return ThreeGangHelperFunctions.threeGangHelperFunctions(
|
||||
deviceId, deviceName, functionValue);
|
||||
}
|
||||
|
||||
static List<SceneStaticFunction> acFunctions(List<FunctionModel> functions, String deviceId,
|
||||
String deviceName, dynamic functionValue, bool isAutomation) {
|
||||
static List<SceneStaticFunction> acFunctions(
|
||||
List<FunctionModel> functions,
|
||||
String deviceId,
|
||||
String deviceName,
|
||||
dynamic functionValue,
|
||||
bool isAutomation) {
|
||||
if (isAutomation) {
|
||||
return ACFunctionsHelper.automationAcFunctions(deviceId, deviceName, functionValue);
|
||||
return ACFunctionsHelper.automationAcFunctions(
|
||||
deviceId, deviceName, functionValue);
|
||||
}
|
||||
return ACFunctionsHelper.tabToRunAcFunctions(deviceId, deviceName, functionValue);
|
||||
return ACFunctionsHelper.tabToRunAcFunctions(
|
||||
deviceId, deviceName, functionValue);
|
||||
}
|
||||
|
||||
List<SceneStaticFunction> getTaskListFunctionsFromApi({
|
||||
@ -149,8 +224,12 @@ mixin SceneOperationsDataHelper {
|
||||
SceneStaticFunction(
|
||||
deviceId: action.entityId,
|
||||
deviceName: action.name.toString(),
|
||||
deviceIcon: action.type == 'automation' ? Assets.player : Assets.handClickIcon,
|
||||
icon: action.type == 'automation' ? Assets.player : Assets.handClickIcon,
|
||||
deviceIcon: action.type == 'automation'
|
||||
? Assets.player
|
||||
: Assets.handClickIcon,
|
||||
icon: action.type == 'automation'
|
||||
? Assets.player
|
||||
: Assets.handClickIcon,
|
||||
operationName: action.type.toString(),
|
||||
operationDialogType: OperationDialogType.onOff,
|
||||
functionValue: action.actionExecutor,
|
||||
@ -170,7 +249,8 @@ mixin SceneOperationsDataHelper {
|
||||
),
|
||||
);
|
||||
} else {
|
||||
functions.add(_mapExecutorPropertyToSceneFunction(action, isAutomation));
|
||||
functions
|
||||
.add(_mapExecutorPropertyToSceneFunction(action, isAutomation));
|
||||
}
|
||||
}
|
||||
|
||||
@ -179,6 +259,8 @@ mixin SceneOperationsDataHelper {
|
||||
for (var condition in conditions) {
|
||||
// Create a dummy Action from Condition to reuse _mapExecutorPropertyToSceneFunction
|
||||
Action dummyAction = Action(
|
||||
deviceName: condition.deviceName,
|
||||
productType: condition.productType,
|
||||
actionExecutor: 'device_report',
|
||||
entityId: condition.entityId,
|
||||
executorProperty: ExecutorProperty(
|
||||
@ -206,7 +288,9 @@ mixin SceneOperationsDataHelper {
|
||||
}) {
|
||||
final executorProperty = action.executorProperty;
|
||||
|
||||
final Map<String, SceneStaticFunction Function(Action, bool, String?, String?)> functionMap = {
|
||||
final Map<String,
|
||||
SceneStaticFunction Function(Action, bool, String?, String?)>
|
||||
functionMap = {
|
||||
'sensitivity': _createSensitivityFunction,
|
||||
'normal_open_switch': _createNormalOpenSwitchFunction,
|
||||
'unlock_fingerprint': _createUnlockFingerprintFunction,
|
||||
@ -282,14 +366,16 @@ mixin SceneOperationsDataHelper {
|
||||
);
|
||||
}
|
||||
|
||||
SceneStaticFunction _createSensitivityFunction(
|
||||
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
SceneStaticFunction _createSensitivityFunction(Action action,
|
||||
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'Presence Sensor',
|
||||
action.deviceName,
|
||||
Assets.assetsIconsSensors,
|
||||
'Sensitivity',
|
||||
isAutomation ? OperationDialogType.integerSteps : OperationDialogType.listOfOptions,
|
||||
isAutomation
|
||||
? OperationDialogType.integerSteps
|
||||
: OperationDialogType.listOfOptions,
|
||||
isAutomation ? _createIntegerStepsOptions() : _createSensitivityOptions(),
|
||||
isAutomation,
|
||||
comparator,
|
||||
@ -297,11 +383,11 @@ mixin SceneOperationsDataHelper {
|
||||
);
|
||||
}
|
||||
|
||||
SceneStaticFunction _createNormalOpenSwitchFunction(
|
||||
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
SceneStaticFunction _createNormalOpenSwitchFunction(Action action,
|
||||
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'WIFI LOCK PRO',
|
||||
action.deviceName,
|
||||
Assets.assetsIconsDoorLock,
|
||||
'Set Door lock Normal Open',
|
||||
OperationDialogType.onOff,
|
||||
@ -351,11 +437,11 @@ mixin SceneOperationsDataHelper {
|
||||
];
|
||||
}
|
||||
|
||||
SceneStaticFunction _createUnlockFingerprintFunction(
|
||||
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
SceneStaticFunction _createUnlockFingerprintFunction(Action action,
|
||||
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'WIFI LOCK PRO',
|
||||
action.deviceName,
|
||||
Assets.assetsIconsDoorLock,
|
||||
'Fingerprint Unlock',
|
||||
OperationDialogType.integerSteps,
|
||||
@ -366,11 +452,11 @@ mixin SceneOperationsDataHelper {
|
||||
);
|
||||
}
|
||||
|
||||
SceneStaticFunction _createUnlockPasswordFunction(
|
||||
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
SceneStaticFunction _createUnlockPasswordFunction(Action action,
|
||||
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'WIFI LOCK PRO',
|
||||
action.deviceName,
|
||||
Assets.assetsIconsDoorLock,
|
||||
'Password Unlock',
|
||||
OperationDialogType.integerSteps,
|
||||
@ -381,11 +467,11 @@ mixin SceneOperationsDataHelper {
|
||||
);
|
||||
}
|
||||
|
||||
SceneStaticFunction _createUnlockCardFunction(
|
||||
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
SceneStaticFunction _createUnlockCardFunction(Action action,
|
||||
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'WIFI LOCK PRO',
|
||||
action.deviceName,
|
||||
Assets.assetsIconsDoorLock,
|
||||
'Card Unlock',
|
||||
OperationDialogType.integerSteps,
|
||||
@ -396,11 +482,11 @@ mixin SceneOperationsDataHelper {
|
||||
);
|
||||
}
|
||||
|
||||
SceneStaticFunction _createAlarmLockFunction(
|
||||
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
SceneStaticFunction _createAlarmLockFunction(Action action, bool isAutomation,
|
||||
String? comparator, String? uniqueCustomId) {
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'WIFI LOCK PRO',
|
||||
action.deviceName,
|
||||
Assets.assetsIconsDoorLock,
|
||||
'Lock Alarm',
|
||||
OperationDialogType.listOfOptions,
|
||||
@ -411,11 +497,11 @@ mixin SceneOperationsDataHelper {
|
||||
);
|
||||
}
|
||||
|
||||
SceneStaticFunction _createUnlockRequestFunction(
|
||||
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
SceneStaticFunction _createUnlockRequestFunction(Action action,
|
||||
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'WIFI LOCK PRO',
|
||||
action.deviceName,
|
||||
Assets.assetsIconsDoorLock,
|
||||
'Remote Unlock Request',
|
||||
OperationDialogType.integerSteps,
|
||||
@ -426,11 +512,11 @@ mixin SceneOperationsDataHelper {
|
||||
);
|
||||
}
|
||||
|
||||
SceneStaticFunction _createResidualElectricityFunction(
|
||||
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
SceneStaticFunction _createResidualElectricityFunction(Action action,
|
||||
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'WIFI LOCK PRO',
|
||||
action.deviceName,
|
||||
Assets.assetsIconsDoorLock,
|
||||
'Residual Electricity',
|
||||
OperationDialogType.integerSteps,
|
||||
@ -441,11 +527,11 @@ mixin SceneOperationsDataHelper {
|
||||
);
|
||||
}
|
||||
|
||||
SceneStaticFunction _createReverseLockFunction(
|
||||
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
SceneStaticFunction _createReverseLockFunction(Action action,
|
||||
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'WIFI LOCK PRO',
|
||||
action.deviceName,
|
||||
Assets.assetsIconsDoorLock,
|
||||
'Double Lock',
|
||||
OperationDialogType.onOff,
|
||||
@ -456,11 +542,11 @@ mixin SceneOperationsDataHelper {
|
||||
);
|
||||
}
|
||||
|
||||
SceneStaticFunction _createUnlockAppFunction(
|
||||
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
SceneStaticFunction _createUnlockAppFunction(Action action, bool isAutomation,
|
||||
String? comparator, String? uniqueCustomId) {
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'WIFI LOCK PRO',
|
||||
action.deviceName,
|
||||
Assets.assetsIconsDoorLock,
|
||||
'Remote Unlock Via App',
|
||||
OperationDialogType.integerSteps,
|
||||
@ -471,11 +557,11 @@ mixin SceneOperationsDataHelper {
|
||||
);
|
||||
}
|
||||
|
||||
SceneStaticFunction _createHijackFunction(
|
||||
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
SceneStaticFunction _createHijackFunction(Action action, bool isAutomation,
|
||||
String? comparator, String? uniqueCustomId) {
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'WIFI LOCK PRO',
|
||||
action.deviceName,
|
||||
Assets.assetsIconsDoorLock,
|
||||
'Hijack Alarm',
|
||||
OperationDialogType.onOff,
|
||||
@ -486,11 +572,11 @@ mixin SceneOperationsDataHelper {
|
||||
);
|
||||
}
|
||||
|
||||
SceneStaticFunction _createDoorbellFunction(
|
||||
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
SceneStaticFunction _createDoorbellFunction(Action action, bool isAutomation,
|
||||
String? comparator, String? uniqueCustomId) {
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'WIFI LOCK PRO',
|
||||
action.deviceName,
|
||||
Assets.assetsIconsDoorLock,
|
||||
'Doorbell',
|
||||
OperationDialogType.onOff,
|
||||
@ -501,11 +587,11 @@ mixin SceneOperationsDataHelper {
|
||||
);
|
||||
}
|
||||
|
||||
SceneStaticFunction _createUnlockTemporaryFunction(
|
||||
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
SceneStaticFunction _createUnlockTemporaryFunction(Action action,
|
||||
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'WIFI LOCK PRO',
|
||||
action.deviceName,
|
||||
Assets.assetsIconsDoorLock,
|
||||
'Temporary Password Unlock',
|
||||
OperationDialogType.integerSteps,
|
||||
@ -516,11 +602,11 @@ mixin SceneOperationsDataHelper {
|
||||
);
|
||||
}
|
||||
|
||||
SceneStaticFunction _createFarDetectionFunction(
|
||||
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
SceneStaticFunction _createFarDetectionFunction(Action action,
|
||||
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'Human Presence Sensor',
|
||||
action.deviceName,
|
||||
Assets.assetsIconsSensors,
|
||||
'Far Detection',
|
||||
OperationDialogType.listOfOptions,
|
||||
@ -531,11 +617,11 @@ mixin SceneOperationsDataHelper {
|
||||
);
|
||||
}
|
||||
|
||||
SceneStaticFunction _createMotionSensitivityFunction(
|
||||
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
SceneStaticFunction _createMotionSensitivityFunction(Action action,
|
||||
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'Human Presence Sensor',
|
||||
action.deviceName,
|
||||
Assets.assetsIconsSensors,
|
||||
'Motion Detection Sensitivity',
|
||||
OperationDialogType.listOfOptions,
|
||||
@ -546,11 +632,11 @@ mixin SceneOperationsDataHelper {
|
||||
);
|
||||
}
|
||||
|
||||
SceneStaticFunction _createMotionlessSensitivityFunction(
|
||||
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
SceneStaticFunction _createMotionlessSensitivityFunction(Action action,
|
||||
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'Human Presence Sensor',
|
||||
action.deviceName,
|
||||
Assets.assetsIconsSensors,
|
||||
'Motionless Detection Sensitivity',
|
||||
OperationDialogType.listOfOptions,
|
||||
@ -561,11 +647,11 @@ mixin SceneOperationsDataHelper {
|
||||
);
|
||||
}
|
||||
|
||||
SceneStaticFunction _createIndicatorFunction(
|
||||
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
SceneStaticFunction _createIndicatorFunction(Action action, bool isAutomation,
|
||||
String? comparator, String? uniqueCustomId) {
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'Human Presence Sensor',
|
||||
action.deviceName,
|
||||
Assets.assetsIconsSensors,
|
||||
'Indicator',
|
||||
OperationDialogType.onOff,
|
||||
@ -576,11 +662,11 @@ mixin SceneOperationsDataHelper {
|
||||
);
|
||||
}
|
||||
|
||||
SceneStaticFunction _createPresenceTimeFunction(
|
||||
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
SceneStaticFunction _createPresenceTimeFunction(Action action,
|
||||
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'Human Presence Sensor',
|
||||
action.deviceName,
|
||||
Assets.assetsIconsSensors,
|
||||
'Nobody Time',
|
||||
OperationDialogType.countdown,
|
||||
@ -591,11 +677,11 @@ mixin SceneOperationsDataHelper {
|
||||
);
|
||||
}
|
||||
|
||||
SceneStaticFunction _createPresenceStateFunction(
|
||||
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
SceneStaticFunction _createPresenceStateFunction(Action action,
|
||||
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'Human Presence Sensor',
|
||||
action.deviceName,
|
||||
Assets.assetsIconsSensors,
|
||||
'Presence State',
|
||||
OperationDialogType.listOfOptions,
|
||||
@ -606,14 +692,16 @@ mixin SceneOperationsDataHelper {
|
||||
);
|
||||
}
|
||||
|
||||
SceneStaticFunction _createDisCurrentFunction(
|
||||
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
SceneStaticFunction _createDisCurrentFunction(Action action,
|
||||
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'Human Presence Sensor',
|
||||
action.deviceName,
|
||||
Assets.assetsIconsSensors,
|
||||
'Current Distance',
|
||||
isAutomation ? OperationDialogType.integerSteps : OperationDialogType.countdown,
|
||||
isAutomation
|
||||
? OperationDialogType.integerSteps
|
||||
: OperationDialogType.countdown,
|
||||
_createCurrentDistanceOptions(),
|
||||
isAutomation,
|
||||
comparator,
|
||||
@ -621,11 +709,11 @@ mixin SceneOperationsDataHelper {
|
||||
);
|
||||
}
|
||||
|
||||
SceneStaticFunction _createIlluminanceValueFunction(
|
||||
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
SceneStaticFunction _createIlluminanceValueFunction(Action action,
|
||||
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'Human Presence Sensor',
|
||||
action.deviceName,
|
||||
Assets.assetsIconsSensors,
|
||||
'Illuminance Value',
|
||||
OperationDialogType.integerSteps,
|
||||
@ -636,11 +724,11 @@ mixin SceneOperationsDataHelper {
|
||||
);
|
||||
}
|
||||
|
||||
SceneStaticFunction _createCheckingResultFunction(
|
||||
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
SceneStaticFunction _createCheckingResultFunction(Action action,
|
||||
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'Human Presence Sensor',
|
||||
action.deviceName,
|
||||
Assets.assetsIconsSensors,
|
||||
'Self-Test Result',
|
||||
OperationDialogType.listOfOptions,
|
||||
@ -651,11 +739,11 @@ mixin SceneOperationsDataHelper {
|
||||
);
|
||||
}
|
||||
|
||||
SceneStaticFunction _createSwitchFunction(
|
||||
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
SceneStaticFunction _createSwitchFunction(Action action, bool isAutomation,
|
||||
String? comparator, String? uniqueCustomId) {
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'Smart AC Thermostat - Grey - Model A',
|
||||
action.deviceName,
|
||||
Assets.assetsIconsAC,
|
||||
'Power',
|
||||
OperationDialogType.onOff,
|
||||
@ -666,26 +754,30 @@ mixin SceneOperationsDataHelper {
|
||||
);
|
||||
}
|
||||
|
||||
SceneStaticFunction _createTempSetFunction(
|
||||
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
SceneStaticFunction _createTempSetFunction(Action action, bool isAutomation,
|
||||
String? comparator, String? uniqueCustomId) {
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'Smart AC Thermostat - Grey - Model A',
|
||||
action.deviceName,
|
||||
Assets.assetsIconsAC,
|
||||
'Set Temperature',
|
||||
isAutomation ? OperationDialogType.integerSteps : OperationDialogType.temperature,
|
||||
isAutomation ? _createAutomationTemperatureOptions() : _createTemperatureOptions(),
|
||||
isAutomation
|
||||
? OperationDialogType.integerSteps
|
||||
: OperationDialogType.temperature,
|
||||
isAutomation
|
||||
? _createAutomationTemperatureOptions()
|
||||
: _createTemperatureOptions(),
|
||||
isAutomation,
|
||||
comparator,
|
||||
uniqueCustomId,
|
||||
);
|
||||
}
|
||||
|
||||
SceneStaticFunction _createTempCurrentFunction(
|
||||
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
SceneStaticFunction _createTempCurrentFunction(Action action,
|
||||
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'Smart AC Thermostat - Grey - Model A',
|
||||
action.deviceName,
|
||||
Assets.assetsIconsAC,
|
||||
'Current Temperature',
|
||||
OperationDialogType.integerSteps,
|
||||
@ -696,11 +788,11 @@ mixin SceneOperationsDataHelper {
|
||||
);
|
||||
}
|
||||
|
||||
SceneStaticFunction _createModeFunction(
|
||||
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
SceneStaticFunction _createModeFunction(Action action, bool isAutomation,
|
||||
String? comparator, String? uniqueCustomId) {
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'Smart AC Thermostat - Grey - Model A',
|
||||
action.deviceName,
|
||||
Assets.assetsIconsAC,
|
||||
'Mode',
|
||||
OperationDialogType.listOfOptions,
|
||||
@ -711,11 +803,11 @@ mixin SceneOperationsDataHelper {
|
||||
);
|
||||
}
|
||||
|
||||
SceneStaticFunction _createLevelFunction(
|
||||
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
SceneStaticFunction _createLevelFunction(Action action, bool isAutomation,
|
||||
String? comparator, String? uniqueCustomId) {
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'Smart AC Thermostat - Grey - Model A',
|
||||
action.deviceName,
|
||||
Assets.assetsIconsAC,
|
||||
'Fan Speed',
|
||||
OperationDialogType.listOfOptions,
|
||||
@ -726,11 +818,11 @@ mixin SceneOperationsDataHelper {
|
||||
);
|
||||
}
|
||||
|
||||
SceneStaticFunction _createChildLockFunction(
|
||||
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
SceneStaticFunction _createChildLockFunction(Action action, bool isAutomation,
|
||||
String? comparator, String? uniqueCustomId) {
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'Smart AC Thermostat - Grey - Model A',
|
||||
action.deviceName,
|
||||
Assets.assetsIconsAC,
|
||||
'Child Lock',
|
||||
OperationDialogType.onOff,
|
||||
@ -741,11 +833,13 @@ mixin SceneOperationsDataHelper {
|
||||
);
|
||||
}
|
||||
|
||||
SceneStaticFunction _createSwitch1Function(
|
||||
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
SceneStaticFunction _createSwitch1Function(Action action, bool isAutomation,
|
||||
String? comparator, String? uniqueCustomId) {
|
||||
switch (action.productType) {
|
||||
case "3G":
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'3 Gang Button Switch L-L',
|
||||
action.deviceName,
|
||||
Assets.assetsIcons3GangSwitch,
|
||||
'Light 1 Switch',
|
||||
OperationDialogType.onOff,
|
||||
@ -754,13 +848,52 @@ mixin SceneOperationsDataHelper {
|
||||
comparator,
|
||||
uniqueCustomId,
|
||||
);
|
||||
}
|
||||
|
||||
SceneStaticFunction _createSwitch2Function(
|
||||
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
case "2G":
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'3 Gang Button Switch L-L',
|
||||
action.deviceName,
|
||||
Assets.twoGang,
|
||||
'Light 1 Switch',
|
||||
OperationDialogType.onOff,
|
||||
_createOnOffOptions(),
|
||||
isAutomation,
|
||||
comparator,
|
||||
uniqueCustomId,
|
||||
);
|
||||
case "1G":
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
action.deviceName,
|
||||
Assets.oneGang,
|
||||
'Light 1 Switch',
|
||||
OperationDialogType.onOff,
|
||||
_createOnOffOptions(),
|
||||
isAutomation,
|
||||
comparator,
|
||||
uniqueCustomId,
|
||||
);
|
||||
default:
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'None',
|
||||
Assets.assetsRemoteUnlockReq,
|
||||
'None',
|
||||
OperationDialogType.onOff,
|
||||
_createOnOffOptions(),
|
||||
isAutomation,
|
||||
comparator,
|
||||
uniqueCustomId,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
SceneStaticFunction _createSwitch2Function(Action action, bool isAutomation,
|
||||
String? comparator, String? uniqueCustomId) {
|
||||
switch (action.productType) {
|
||||
case "3G":
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
action.deviceName,
|
||||
Assets.assetsIcons3GangSwitch,
|
||||
'Light 2 Switch',
|
||||
OperationDialogType.onOff,
|
||||
@ -769,13 +902,38 @@ mixin SceneOperationsDataHelper {
|
||||
comparator,
|
||||
uniqueCustomId,
|
||||
);
|
||||
}
|
||||
|
||||
SceneStaticFunction _createSwitch3Function(
|
||||
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
case "2G":
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'3 Gang Button Switch L-L',
|
||||
action.deviceName,
|
||||
Assets.twoGang,
|
||||
'Light 2 Switch',
|
||||
OperationDialogType.onOff,
|
||||
_createOnOffOptions(),
|
||||
isAutomation,
|
||||
comparator,
|
||||
uniqueCustomId,
|
||||
);
|
||||
default:
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
action.deviceName,
|
||||
Assets.oneGang,
|
||||
'Light Switch',
|
||||
OperationDialogType.onOff,
|
||||
_createOnOffOptions(),
|
||||
isAutomation,
|
||||
comparator,
|
||||
uniqueCustomId,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
SceneStaticFunction _createSwitch3Function(Action action, bool isAutomation,
|
||||
String? comparator, String? uniqueCustomId) {
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
action.deviceName,
|
||||
Assets.assetsIcons3GangSwitch,
|
||||
'Light 3 Switch',
|
||||
OperationDialogType.onOff,
|
||||
@ -786,56 +944,138 @@ mixin SceneOperationsDataHelper {
|
||||
);
|
||||
}
|
||||
|
||||
SceneStaticFunction _createCountdown1Function(
|
||||
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
SceneStaticFunction _createCountdown1Function(Action action,
|
||||
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
switch (action.productType) {
|
||||
case "3G":
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'3 Gang Button Switch L-L',
|
||||
action.deviceName,
|
||||
Assets.assetsIcons3GangSwitch,
|
||||
'Light 1 CountDown',
|
||||
isAutomation ? OperationDialogType.integerSteps : OperationDialogType.countdown,
|
||||
isAutomation ? _createAutomationCountDownOptions() : _createCountdownOptions(),
|
||||
isAutomation
|
||||
? OperationDialogType.integerSteps
|
||||
: OperationDialogType.countdown,
|
||||
isAutomation
|
||||
? _createAutomationCountDownOptions()
|
||||
: _createCountdownOptions(),
|
||||
isAutomation,
|
||||
comparator,
|
||||
uniqueCustomId,
|
||||
);
|
||||
case "2G":
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
action.deviceName,
|
||||
Assets.twoGang,
|
||||
'Light 1 CountDown',
|
||||
isAutomation
|
||||
? OperationDialogType.integerSteps
|
||||
: OperationDialogType.countdown,
|
||||
isAutomation
|
||||
? _createAutomationCountDownOptions()
|
||||
: _createCountdownOptions(),
|
||||
isAutomation,
|
||||
comparator,
|
||||
uniqueCustomId,
|
||||
);
|
||||
default:
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
action.deviceName,
|
||||
Assets.oneGang,
|
||||
'Light CountDown',
|
||||
isAutomation
|
||||
? OperationDialogType.integerSteps
|
||||
: OperationDialogType.countdown,
|
||||
isAutomation
|
||||
? _createAutomationCountDownOptions()
|
||||
: _createCountdownOptions(),
|
||||
isAutomation,
|
||||
comparator,
|
||||
uniqueCustomId,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
SceneStaticFunction _createCountdown2Function(
|
||||
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
SceneStaticFunction _createCountdown2Function(Action action,
|
||||
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
switch (action.productType) {
|
||||
case "3G":
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'3 Gang Button Switch L-L',
|
||||
action.deviceName,
|
||||
Assets.assetsIcons3GangSwitch,
|
||||
'Light 2 CountDown',
|
||||
isAutomation ? OperationDialogType.integerSteps : OperationDialogType.countdown,
|
||||
isAutomation ? _createAutomationCountDownOptions() : _createCountdownOptions(),
|
||||
isAutomation
|
||||
? OperationDialogType.integerSteps
|
||||
: OperationDialogType.countdown,
|
||||
isAutomation
|
||||
? _createAutomationCountDownOptions()
|
||||
: _createCountdownOptions(),
|
||||
isAutomation,
|
||||
comparator,
|
||||
uniqueCustomId,
|
||||
);
|
||||
case "2G":
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
action.deviceName,
|
||||
Assets.twoGang,
|
||||
'Light 2 CountDown',
|
||||
isAutomation
|
||||
? OperationDialogType.integerSteps
|
||||
: OperationDialogType.countdown,
|
||||
isAutomation
|
||||
? _createAutomationCountDownOptions()
|
||||
: _createCountdownOptions(),
|
||||
isAutomation,
|
||||
comparator,
|
||||
uniqueCustomId,
|
||||
);
|
||||
default:
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
action.deviceName,
|
||||
Assets.oneGang,
|
||||
'Light CountDown',
|
||||
isAutomation
|
||||
? OperationDialogType.integerSteps
|
||||
: OperationDialogType.countdown,
|
||||
isAutomation
|
||||
? _createAutomationCountDownOptions()
|
||||
: _createCountdownOptions(),
|
||||
isAutomation,
|
||||
comparator,
|
||||
uniqueCustomId,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
SceneStaticFunction _createCountdown3Function(
|
||||
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
SceneStaticFunction _createCountdown3Function(Action action,
|
||||
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'3 Gang Button Switch L-L',
|
||||
action.deviceName,
|
||||
Assets.assetsIcons3GangSwitch,
|
||||
'Light 3 CountDown',
|
||||
isAutomation ? OperationDialogType.integerSteps : OperationDialogType.countdown,
|
||||
isAutomation ? _createAutomationCountDownOptions() : _createCountdownOptions(),
|
||||
isAutomation
|
||||
? OperationDialogType.integerSteps
|
||||
: OperationDialogType.countdown,
|
||||
isAutomation
|
||||
? _createAutomationCountDownOptions()
|
||||
: _createCountdownOptions(),
|
||||
isAutomation,
|
||||
comparator,
|
||||
uniqueCustomId,
|
||||
);
|
||||
}
|
||||
|
||||
SceneStaticFunction _createSwitchAlarmSoundFunction(
|
||||
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
SceneStaticFunction _createSwitchAlarmSoundFunction(Action action,
|
||||
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'Gateway',
|
||||
action.deviceName,
|
||||
Assets.assetsIconsGateway,
|
||||
'Switch Alarm Sound',
|
||||
OperationDialogType.onOff,
|
||||
@ -846,11 +1086,11 @@ mixin SceneOperationsDataHelper {
|
||||
);
|
||||
}
|
||||
|
||||
SceneStaticFunction _createMasterStateFunction(
|
||||
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
SceneStaticFunction _createMasterStateFunction(Action action,
|
||||
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'Gateway',
|
||||
action.deviceName,
|
||||
Assets.assetsIconsGateway,
|
||||
'Master State',
|
||||
OperationDialogType.listOfOptions,
|
||||
@ -861,11 +1101,11 @@ mixin SceneOperationsDataHelper {
|
||||
);
|
||||
}
|
||||
|
||||
SceneStaticFunction _createFactoryResetFunction(
|
||||
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
SceneStaticFunction _createFactoryResetFunction(Action action,
|
||||
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'Gateway',
|
||||
action.deviceName,
|
||||
Assets.assetsIconsGateway,
|
||||
'Factory Reset',
|
||||
OperationDialogType.onOff,
|
||||
@ -1180,8 +1420,12 @@ mixin SceneOperationsDataHelper {
|
||||
uniqueCustomId: taskItem.uniqueCustomId,
|
||||
deviceId: taskItem.deviceId,
|
||||
deviceName: taskItem.deviceName.toString(),
|
||||
deviceIcon: taskItem.operationName == 'automation' ? Assets.player : Assets.handClickIcon,
|
||||
icon: taskItem.operationName == 'automation' ? Assets.player : Assets.handClickIcon,
|
||||
deviceIcon: taskItem.operationName == 'automation'
|
||||
? Assets.player
|
||||
: Assets.handClickIcon,
|
||||
icon: taskItem.operationName == 'automation'
|
||||
? Assets.player
|
||||
: Assets.handClickIcon,
|
||||
operationName: taskItem.operationName,
|
||||
operationDialogType: OperationDialogType.onOff,
|
||||
functionValue: taskItem.functionValue == 'rule_enable' ? true : false,
|
||||
@ -1204,6 +1448,8 @@ mixin SceneOperationsDataHelper {
|
||||
return [
|
||||
_mapExecutorPropertyToSceneFunction(
|
||||
Action(
|
||||
deviceName: taskItem.deviceName,
|
||||
productType: '',
|
||||
entityId: deviceId,
|
||||
executorProperty: ExecutorProperty(
|
||||
functionCode: taskItem.code,
|
||||
|
||||
@ -74,6 +74,9 @@ class Action {
|
||||
ExecutorProperty? executorProperty;
|
||||
String? name;
|
||||
String? type;
|
||||
final String productType;
|
||||
|
||||
final String deviceName;
|
||||
|
||||
Action({
|
||||
required this.actionExecutor,
|
||||
@ -81,6 +84,8 @@ class Action {
|
||||
this.executorProperty,
|
||||
this.name,
|
||||
this.type,
|
||||
required this.productType,
|
||||
required this.deviceName,
|
||||
});
|
||||
|
||||
String toRawJson() => json.encode(toJson());
|
||||
@ -88,10 +93,12 @@ class Action {
|
||||
static Action? fromJson(Map<String, dynamic> json) {
|
||||
if (json['name'] != null && json['type'] != null) {
|
||||
return Action(
|
||||
actionExecutor: json["actionExecutor"],
|
||||
entityId: json["entityId"],
|
||||
name: json['name'],
|
||||
type: json['type'],
|
||||
actionExecutor: json["actionExecutor"] as String,
|
||||
entityId: json["entityId"] as String,
|
||||
name: json['name'] as String?,
|
||||
type: json['type'] as String?,
|
||||
productType: json['productType'] as String,
|
||||
deviceName: json['deviceName'] as String,
|
||||
);
|
||||
}
|
||||
if (json["executorProperty"] == null) {
|
||||
@ -99,9 +106,11 @@ class Action {
|
||||
}
|
||||
|
||||
return Action(
|
||||
actionExecutor: json["actionExecutor"],
|
||||
entityId: json["entityId"],
|
||||
actionExecutor: json["actionExecutor"] as String,
|
||||
entityId: json["entityId"] as String,
|
||||
executorProperty: ExecutorProperty.fromJson(json["executorProperty"]),
|
||||
productType: json['productType'] as String,
|
||||
deviceName: json['deviceName'] as String,
|
||||
);
|
||||
}
|
||||
|
||||
@ -142,12 +151,16 @@ class Condition {
|
||||
final String entityId;
|
||||
final String entityType;
|
||||
final Expr expr;
|
||||
final String productType;
|
||||
final String deviceName;
|
||||
|
||||
Condition({
|
||||
required this.code,
|
||||
required this.entityId,
|
||||
required this.entityType,
|
||||
required this.expr,
|
||||
required this.productType,
|
||||
required this.deviceName,
|
||||
});
|
||||
|
||||
factory Condition.fromRawJson(String str) =>
|
||||
@ -160,6 +173,8 @@ class Condition {
|
||||
entityId: json["entityId"],
|
||||
entityType: json["entityType"],
|
||||
expr: Expr.fromJson(json["expr"]),
|
||||
productType: json['productType'] as String,
|
||||
deviceName: json['deviceName'] as String,
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
import 'package:syncrow_app/features/devices/model/device_control_model.dart';
|
||||
import 'package:syncrow_app/features/devices/model/device_model.dart';
|
||||
import 'package:syncrow_app/features/scene/bloc/create_scene/create_scene_bloc.dart';
|
||||
@ -11,11 +12,10 @@ import 'package:syncrow_app/features/scene/widgets/scene_list_tile.dart';
|
||||
import 'package:syncrow_app/features/shared_widgets/default_container.dart';
|
||||
import 'package:syncrow_app/features/shared_widgets/default_scaffold.dart';
|
||||
import 'package:syncrow_app/features/shared_widgets/light_divider.dart';
|
||||
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_medium.dart';
|
||||
import 'package:syncrow_app/generated/assets.dart';
|
||||
import 'package:syncrow_app/navigation/navigate_to_route.dart';
|
||||
import 'package:syncrow_app/navigation/routing_constants.dart';
|
||||
import 'package:syncrow_app/utils/context_extension.dart';
|
||||
|
||||
import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
|
||||
|
||||
class DeviceFunctionsView extends StatelessWidget
|
||||
@ -51,22 +51,14 @@ class DeviceFunctionsView extends StatelessWidget
|
||||
.add(AddTaskEvent(isAutomation: isAutomation));
|
||||
navigateToRoute(context, Routes.sceneTasksRoute);
|
||||
},
|
||||
child: BodyMedium(
|
||||
text: 'Save',
|
||||
fontWeight: FontWeight.normal,
|
||||
fontColor: ColorsManager.secondaryColor.withOpacity(0.6),
|
||||
),
|
||||
child: SvgPicture.asset(Assets.saveRoutinesIcon),
|
||||
),
|
||||
],
|
||||
leading: TextButton(
|
||||
onPressed: () {
|
||||
_cancelOperation(context, device, isAutomation);
|
||||
},
|
||||
child: BodyMedium(
|
||||
text: 'Cancel',
|
||||
fontWeight: FontWeight.normal,
|
||||
fontColor: ColorsManager.textPrimaryColor.withOpacity(0.6),
|
||||
),
|
||||
child: SvgPicture.asset(Assets.cancelIcon),
|
||||
),
|
||||
leadingWidth: 80,
|
||||
padding: EdgeInsets.zero,
|
||||
@ -75,6 +67,63 @@ class DeviceFunctionsView extends StatelessWidget
|
||||
itemCount: functions.length,
|
||||
padding: const EdgeInsets.only(top: 24.0),
|
||||
itemBuilder: (context, index) {
|
||||
if (device.productType!.name.toString() == 'ThreeGang' ||
|
||||
device.productType!.name.toString() == 'TwoGang') {
|
||||
final bool isFirstInPair = index % 2 == 0;
|
||||
final bool isLastInPair =
|
||||
index % 2 == 1 || index == functions.length - 1;
|
||||
final bool isLastItem = index == functions.length - 1;
|
||||
return Column(mainAxisSize: MainAxisSize.min, children: [
|
||||
if (isFirstInPair && index != 0) const SizedBox(height: 16),
|
||||
DefaultContainer(
|
||||
padding: EdgeInsets.only(
|
||||
top: isFirstInPair ? 8 : 0,
|
||||
bottom: isLastInPair ? 8 : 0,
|
||||
),
|
||||
margin: EdgeInsets.zero,
|
||||
borderRadius: BorderRadius.only(
|
||||
topLeft: Radius.circular(isFirstInPair ? 20 : 0),
|
||||
topRight: Radius.circular(isFirstInPair ? 20 : 0),
|
||||
bottomLeft: Radius.circular(isLastInPair ? 20 : 0),
|
||||
bottomRight: Radius.circular(isLastInPair ? 20 : 0),
|
||||
),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
BlocBuilder<CreateSceneBloc, CreateSceneState>(
|
||||
builder: (context, state) {
|
||||
return SceneListTile(
|
||||
iconsSize: 22,
|
||||
minLeadingWidth: 20,
|
||||
assetPath: functions[index].icon,
|
||||
titleString: functions[index].operationName,
|
||||
trailingWidget: const Icon(
|
||||
Icons.arrow_forward_ios_rounded,
|
||||
color: ColorsManager.greyColor,
|
||||
size: 16,
|
||||
),
|
||||
onPressed: () {
|
||||
if (isAutomation) {
|
||||
_showAutomationDialog(
|
||||
context, functions[index], device);
|
||||
} else {
|
||||
_showTabToRunDialog(
|
||||
context, functions[index], device);
|
||||
}
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
if (isFirstInPair && !isLastItem)
|
||||
SizedBox(
|
||||
width: context.width * 0.8,
|
||||
child: const LightDivider(),
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
]);
|
||||
} else {
|
||||
return DefaultContainer(
|
||||
padding: index == 0
|
||||
? const EdgeInsets.only(top: 8)
|
||||
@ -82,13 +131,23 @@ class DeviceFunctionsView extends StatelessWidget
|
||||
? const EdgeInsets.only(bottom: 8)
|
||||
: EdgeInsets.zero,
|
||||
margin: EdgeInsets.zero,
|
||||
borderRadius: index == 0
|
||||
borderRadius: index == 0 && index == functions.length - 1
|
||||
? const BorderRadius.only(
|
||||
topLeft: Radius.circular(20), topRight: Radius.circular(20))
|
||||
topLeft: Radius.circular(20),
|
||||
topRight: Radius.circular(20),
|
||||
bottomLeft: Radius.circular(20),
|
||||
bottomRight: Radius.circular(20),
|
||||
)
|
||||
: index == 0
|
||||
? const BorderRadius.only(
|
||||
topLeft: Radius.circular(20),
|
||||
topRight: Radius.circular(20),
|
||||
)
|
||||
: index == functions.length - 1
|
||||
? const BorderRadius.only(
|
||||
bottomLeft: Radius.circular(20),
|
||||
bottomRight: Radius.circular(20))
|
||||
bottomRight: Radius.circular(20),
|
||||
)
|
||||
: BorderRadius.zero,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
@ -113,28 +172,22 @@ class DeviceFunctionsView extends StatelessWidget
|
||||
onPressed: () {
|
||||
if (isAutomation) {
|
||||
_showAutomationDialog(
|
||||
context,
|
||||
functions[index],
|
||||
device,
|
||||
);
|
||||
context, functions[index], device);
|
||||
} else {
|
||||
_showTabToRunDialog(
|
||||
context,
|
||||
functions[index],
|
||||
device,
|
||||
);
|
||||
context, functions[index], device);
|
||||
}
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
}),
|
||||
index != functions.length - 1
|
||||
? SizedBox(
|
||||
width: context.width * 0.8, child: const LightDivider())
|
||||
width: context.width * 0.8,
|
||||
child: const LightDivider())
|
||||
: const SizedBox(),
|
||||
],
|
||||
),
|
||||
);
|
||||
));
|
||||
}
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
@ -1142,5 +1142,9 @@ class Assets {
|
||||
|
||||
static const String toggleSwitchSmall = 'assets/icons/toggleSwitchSmall.svg';
|
||||
static const String offToggleSwitchSmall = 'assets/icons/offToggleSwitchSmall.svg';
|
||||
static const String saveRoutinesIcon = 'assets/icons/save_routines_icon.svg';
|
||||
static const String cancelIcon = 'assets/icons/cancel_icon.svg';
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -11,7 +11,7 @@ abstract class ApiEndpoints {
|
||||
static const String sendOtp = '/authentication/user/send-otp';
|
||||
static const String verifyOtp = '/authentication/user/verify-otp';
|
||||
static const String forgetPassword = '/authentication/user/forget-password';
|
||||
static const String clientLogin = 'client/token';
|
||||
static const String clientLogin = '/client/token';
|
||||
////////////////////////////////////// Spaces ///////////////////////////////////////
|
||||
|
||||
///Community Module
|
||||
|
||||
Reference in New Issue
Block a user