From 007e1707550fbc94dc36d005aba286eb817abf5c Mon Sep 17 00:00:00 2001 From: ashrafzarkanisala Date: Tue, 16 Jul 2024 22:47:06 +0300 Subject: [PATCH] push add temp task flag --- .../scene/helper/scene_logic_helper.dart | 2 +- .../scene/view/device_functions_view.dart | 31 ++++++++++--------- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/lib/features/scene/helper/scene_logic_helper.dart b/lib/features/scene/helper/scene_logic_helper.dart index 95d302d..3c115b4 100644 --- a/lib/features/scene/helper/scene_logic_helper.dart +++ b/lib/features/scene/helper/scene_logic_helper.dart @@ -93,7 +93,7 @@ mixin SceneLogicHelper { OperationDialogType.countdown) || (taskItem.operationDialogType == OperationDialogType.delay)) { return AlertDialogCountdown( - durationValue: taskItem.functionValue, + durationValue: taskItem.functionValue ?? 0, functionValue: functionValue ?? taskItem.functionValue, function: taskItem, ); diff --git a/lib/features/scene/view/device_functions_view.dart b/lib/features/scene/view/device_functions_view.dart index a98fe4d..0990a32 100644 --- a/lib/features/scene/view/device_functions_view.dart +++ b/lib/features/scene/view/device_functions_view.dart @@ -230,26 +230,27 @@ class DeviceFunctionsView extends StatelessWidget void _showAutomationDialog( BuildContext context, SceneStaticFunction function, DeviceModel device) { - final functionValues = - context.read().selectedValues[function.code]; + final automationFunctionValues = + context.read().automationSelectedValues[function.code]; context.customAlertDialog( alertBody: getTheCorrectDialogBody( function, - functionValues, + automationFunctionValues, ), title: function.operationName, onConfirm: () { - final selectedValue = - context.read().selectedValues[function.code]; - if (selectedValue == null) { + final automationFunctionValues = context + .read() + .automationSelectedValues[function.code]; + if (automationFunctionValues == null) { return; } context.read().add(TempHoldSceneTasksEvent( deviceControlModel: DeviceControlModel( deviceId: device.uuid, code: function.code, - value: selectedValue, + value: automationFunctionValues, ), deviceId: device.uuid ?? '', operation: function.operationName, @@ -257,19 +258,19 @@ class DeviceFunctionsView extends StatelessWidget deviceName: device.name ?? '', uniqueId: function.uniqueCustomId, operationType: function.operationDialogType, + isAutomation: true, )); Navigator.pop(context); }, onDismiss: () { - final tempTaskList = context.read().tempTasksList; - for (var element in tempTaskList) { + final automationTempTaskList = + context.read().automationTempTasksList; + for (var element in automationTempTaskList) { if (element.code == function.code) { - context - .read() - .add(RemoveTempTaskByIdEvent(code: function.code)); - context - .read() - .add(RemoveFromSelectedValueById(code: function.code)); + context.read().add(RemoveTempTaskByIdEvent( + code: function.code, isAutomation: true)); + context.read().add(RemoveFromSelectedValueById( + code: function.code, isAutomation: true)); } } Navigator.pop(context);