From 13360fe6f37beb21095b2ddbefe8a09762b0ad23 Mon Sep 17 00:00:00 2001 From: raf-dev1 Date: Fri, 13 Jun 2025 16:10:24 +0300 Subject: [PATCH] when use THEN dialog type Funtions is the word but hen if it should be condition --- .../helper/dialog_helper/device_dialog_helper.dart | 1 + lib/pages/routines/widgets/routine_dialogs/ac_dialog.dart | 4 +++- .../flush_presence_sensor/flush_presence_sensor.dart | 4 +++- .../widgets/routine_dialogs/gateway/gateway_dialog.dart | 7 +++++-- .../widgets/routine_dialogs/gateway/gateway_helper.dart | 2 ++ .../widgets/routine_dialogs/one_gang_switch_dialog.dart | 8 +++++--- .../power_clamp_enargy/energy_clamp_dialog.dart | 4 +++- .../widgets/routine_dialogs/three_gang_switch_dialog.dart | 4 +++- .../widgets/routine_dialogs/two_gang_switch_dialog.dart | 4 +++- .../routine_dialogs/wall_sensor/wall_presence_sensor.dart | 7 +++++-- .../water_heater/water_heater_presence_sensor.dart | 4 +++- 11 files changed, 36 insertions(+), 13 deletions(-) diff --git a/lib/pages/routines/helper/dialog_helper/device_dialog_helper.dart b/lib/pages/routines/helper/dialog_helper/device_dialog_helper.dart index df4683d8..013626d8 100644 --- a/lib/pages/routines/helper/dialog_helper/device_dialog_helper.dart +++ b/lib/pages/routines/helper/dialog_helper/device_dialog_helper.dart @@ -118,6 +118,7 @@ class DeviceDialogHelper { uniqueCustomId: data['uniqueCustomId'], deviceSelectedFunctions: deviceSelectedFunctions, device: data['device'], + dialogType: dialogType, ); case 'NCPS': return FlushPresenceSensor.showFlushFunctionsDialog( diff --git a/lib/pages/routines/widgets/routine_dialogs/ac_dialog.dart b/lib/pages/routines/widgets/routine_dialogs/ac_dialog.dart index cbf13178..6d0ddbfb 100644 --- a/lib/pages/routines/widgets/routine_dialogs/ac_dialog.dart +++ b/lib/pages/routines/widgets/routine_dialogs/ac_dialog.dart @@ -65,7 +65,9 @@ class ACHelper { child: Column( mainAxisSize: MainAxisSize.min, children: [ - const DialogHeader('AC Functions'), + DialogHeader(dialogType == 'THEN' + ? 'AC Functions' + : 'AC Conditions'), Expanded( child: Row( crossAxisAlignment: CrossAxisAlignment.stretch, diff --git a/lib/pages/routines/widgets/routine_dialogs/flush_presence_sensor/flush_presence_sensor.dart b/lib/pages/routines/widgets/routine_dialogs/flush_presence_sensor/flush_presence_sensor.dart index bf2146ad..dad64866 100644 --- a/lib/pages/routines/widgets/routine_dialogs/flush_presence_sensor/flush_presence_sensor.dart +++ b/lib/pages/routines/widgets/routine_dialogs/flush_presence_sensor/flush_presence_sensor.dart @@ -96,7 +96,9 @@ class _WallPresenceSensorState extends State { child: Column( mainAxisSize: MainAxisSize.min, children: [ - const DialogHeader('Presence Sensor Condition'), + DialogHeader(widget.dialogType == 'THEN' + ? 'Presence Sensor Functions' + : 'Presence Sensor Condition'), Expanded(child: _buildMainContent(context, state)), _buildDialogFooter(context, state), ], diff --git a/lib/pages/routines/widgets/routine_dialogs/gateway/gateway_dialog.dart b/lib/pages/routines/widgets/routine_dialogs/gateway/gateway_dialog.dart index 364854ce..33cf8fc0 100644 --- a/lib/pages/routines/widgets/routine_dialogs/gateway/gateway_dialog.dart +++ b/lib/pages/routines/widgets/routine_dialogs/gateway/gateway_dialog.dart @@ -16,9 +16,10 @@ class GatewayDialog extends StatefulWidget { required this.functions, required this.deviceSelectedFunctions, required this.device, + required this.dialogType, super.key, }); - + final String dialogType; final String? uniqueCustomId; final List functions; final List deviceSelectedFunctions; @@ -55,7 +56,9 @@ class _GatewayDialogState extends State { child: Column( mainAxisSize: MainAxisSize.min, children: [ - const DialogHeader('Gateway Conditions'), + DialogHeader(widget.dialogType == 'THEN' + ? 'Gateway Functions' + : 'Gateway Conditions'), Expanded(child: _buildMainContent(context, state)), _buildDialogFooter(context, state), ], diff --git a/lib/pages/routines/widgets/routine_dialogs/gateway/gateway_helper.dart b/lib/pages/routines/widgets/routine_dialogs/gateway/gateway_helper.dart index 9a9351ca..19b866c9 100644 --- a/lib/pages/routines/widgets/routine_dialogs/gateway/gateway_helper.dart +++ b/lib/pages/routines/widgets/routine_dialogs/gateway/gateway_helper.dart @@ -14,6 +14,7 @@ abstract final class GatewayHelper { required String? uniqueCustomId, required List deviceSelectedFunctions, required AllDevicesModel? device, + required String dialogType, }) async { return showDialog( context: context, @@ -27,6 +28,7 @@ abstract final class GatewayHelper { functions: functions, deviceSelectedFunctions: deviceSelectedFunctions, device: device, + dialogType:dialogType, ), ), ); diff --git a/lib/pages/routines/widgets/routine_dialogs/one_gang_switch_dialog.dart b/lib/pages/routines/widgets/routine_dialogs/one_gang_switch_dialog.dart index 641fd234..c892610c 100644 --- a/lib/pages/routines/widgets/routine_dialogs/one_gang_switch_dialog.dart +++ b/lib/pages/routines/widgets/routine_dialogs/one_gang_switch_dialog.dart @@ -59,7 +59,9 @@ class OneGangSwitchHelper { child: Column( mainAxisSize: MainAxisSize.min, children: [ - const DialogHeader('1 Gang Light Switch Condition'), + DialogHeader(dialogType == 'THEN' + ? '1 Gang Light Switch Functions' + : '1 Gang Light Switch Condition'), Expanded( child: Row( children: [ @@ -246,9 +248,9 @@ class OneGangSwitchHelper { withSpecialChar: false, currentCondition: selectedFunctionData?.condition, dialogType: dialogType, - sliderRange: (0, 43200), + sliderRange: (0, 43200), displayedValue: (initialValue ?? 0).toString(), - initialValue: (initialValue ?? 0).toString(), + initialValue: (initialValue ?? 0).toString(), onConditionChanged: (condition) { context.read().add( AddFunction( diff --git a/lib/pages/routines/widgets/routine_dialogs/power_clamp_enargy/energy_clamp_dialog.dart b/lib/pages/routines/widgets/routine_dialogs/power_clamp_enargy/energy_clamp_dialog.dart index 291abf59..b27c5f8a 100644 --- a/lib/pages/routines/widgets/routine_dialogs/power_clamp_enargy/energy_clamp_dialog.dart +++ b/lib/pages/routines/widgets/routine_dialogs/power_clamp_enargy/energy_clamp_dialog.dart @@ -98,7 +98,9 @@ class _EnergyClampDialogState extends State { child: Column( mainAxisSize: MainAxisSize.min, children: [ - const DialogHeader('Energy Clamp Conditions'), + DialogHeader(widget.dialogType == 'THEN' + ? 'Energy Clamp Functions' + : 'Energy Clamp Conditions'), Expanded( child: Visibility( visible: _functions.isNotEmpty, diff --git a/lib/pages/routines/widgets/routine_dialogs/three_gang_switch_dialog.dart b/lib/pages/routines/widgets/routine_dialogs/three_gang_switch_dialog.dart index 5e50c11d..00c3165a 100644 --- a/lib/pages/routines/widgets/routine_dialogs/three_gang_switch_dialog.dart +++ b/lib/pages/routines/widgets/routine_dialogs/three_gang_switch_dialog.dart @@ -58,7 +58,9 @@ class ThreeGangSwitchHelper { child: Column( mainAxisSize: MainAxisSize.min, children: [ - const DialogHeader('3 Gangs Light Switch Condition'), + DialogHeader(dialogType == 'THEN' + ? '3 Gangs Light Switch Functions' + : '3 Gangs Light Switch Condition'), Expanded( child: Row( children: [ diff --git a/lib/pages/routines/widgets/routine_dialogs/two_gang_switch_dialog.dart b/lib/pages/routines/widgets/routine_dialogs/two_gang_switch_dialog.dart index 6b3dc813..93ab83a7 100644 --- a/lib/pages/routines/widgets/routine_dialogs/two_gang_switch_dialog.dart +++ b/lib/pages/routines/widgets/routine_dialogs/two_gang_switch_dialog.dart @@ -59,7 +59,9 @@ class TwoGangSwitchHelper { child: Column( mainAxisSize: MainAxisSize.min, children: [ - const DialogHeader('2 Gangs Light Switch Condition'), + DialogHeader(dialogType == 'THEN' + ? '2 Gangs Light Switch Functions' + : '2 Gangs Light Switch Condition'), Expanded( child: Row( children: [ diff --git a/lib/pages/routines/widgets/routine_dialogs/wall_sensor/wall_presence_sensor.dart b/lib/pages/routines/widgets/routine_dialogs/wall_sensor/wall_presence_sensor.dart index 4d04102d..996e46a8 100644 --- a/lib/pages/routines/widgets/routine_dialogs/wall_sensor/wall_presence_sensor.dart +++ b/lib/pages/routines/widgets/routine_dialogs/wall_sensor/wall_presence_sensor.dart @@ -63,7 +63,8 @@ class _WallPresenceSensorState extends State { @override void initState() { super.initState(); - _wpsFunctions = widget.functions.whereType().where((function) { + _wpsFunctions = + widget.functions.whereType().where((function) { if (widget.dialogType == 'THEN') { return function.type == 'THEN' || function.type == 'BOTH'; } @@ -97,7 +98,9 @@ class _WallPresenceSensorState extends State { child: Column( mainAxisSize: MainAxisSize.min, children: [ - const DialogHeader('Presence Sensor Condition'), + DialogHeader(widget.dialogType == 'THEN' + ? 'Presence Sensor Functions' + : 'Presence Sensor Condition'), Expanded(child: _buildMainContent(context, state)), _buildDialogFooter(context, state), ], diff --git a/lib/pages/routines/widgets/routine_dialogs/water_heater/water_heater_presence_sensor.dart b/lib/pages/routines/widgets/routine_dialogs/water_heater/water_heater_presence_sensor.dart index d87e8484..a4f14aa9 100644 --- a/lib/pages/routines/widgets/routine_dialogs/water_heater/water_heater_presence_sensor.dart +++ b/lib/pages/routines/widgets/routine_dialogs/water_heater/water_heater_presence_sensor.dart @@ -93,7 +93,9 @@ class _WaterHeaterDialogRoutinesState extends State { child: Column( mainAxisSize: MainAxisSize.min, children: [ - const DialogHeader('Water Heater Condition'), + DialogHeader(widget.dialogType == 'THEN' + ? 'Water Heater Funtions' + : 'Water Heater Condition'), Expanded(child: _buildMainContent(context, state)), _buildDialogFooter(context, state), ],