From 0341844ea9ac28ef341ca85e1b0589b06dfea292 Mon Sep 17 00:00:00 2001 From: Abdullah Alassaf Date: Thu, 26 Dec 2024 12:25:37 +0300 Subject: [PATCH] SP-859 --- .../widgets/routine_dialogs/ac_dialog.dart | 38 +++++++------------ 1 file changed, 14 insertions(+), 24 deletions(-) diff --git a/lib/pages/routiens/widgets/routine_dialogs/ac_dialog.dart b/lib/pages/routiens/widgets/routine_dialogs/ac_dialog.dart index 39e342ff..7a630448 100644 --- a/lib/pages/routiens/widgets/routine_dialogs/ac_dialog.dart +++ b/lib/pages/routiens/widgets/routine_dialogs/ac_dialog.dart @@ -27,16 +27,15 @@ class ACHelper { context: context, builder: (BuildContext context) { return BlocProvider( - create: (_) => FunctionBloc() - ..add(InitializeFunctions(deviceSelectedFunctions ?? [])), + create: (_) => FunctionBloc()..add(InitializeFunctions(deviceSelectedFunctions ?? [])), child: AlertDialog( contentPadding: EdgeInsets.zero, content: BlocBuilder( builder: (context, state) { final selectedFunction = state.selectedFunction; final selectedOperationName = state.selectedOperationName; - final selectedFunctionData = state.addedFunctions - .firstWhere((f) => f.functionCode == selectedFunction, + final selectedFunctionData = + state.addedFunctions.firstWhere((f) => f.functionCode == selectedFunction, orElse: () => DeviceFunctionData( entityId: '', functionCode: selectedFunction ?? '', @@ -66,10 +65,8 @@ class ACHelper { child: _buildFunctionsList( context: context, acFunctions: acFunctions, - onFunctionSelected: - (functionCode, operationName) => context - .read() - .add(SelectFunction( + onFunctionSelected: (functionCode, operationName) => + context.read().add(SelectFunction( functionCode: functionCode, operationName: operationName, )), @@ -184,7 +181,7 @@ class ACHelper { bool? removeComparators, }) { if (selectedFunction == 'temp_set' || selectedFunction == 'temp_current') { - final initialValue = selectedFunctionData?.value ?? 200; + final initialValue = selectedFunctionData?.value ?? 250; return _buildTemperatureSelector( context: context, initialValue: initialValue, @@ -197,8 +194,7 @@ class ACHelper { ); } - final selectedFn = - acFunctions.firstWhere((f) => f.code == selectedFunction); + final selectedFn = acFunctions.firstWhere((f) => f.code == selectedFunction); final values = selectedFn.getOperationalValues(); return _buildOperationalValuesList( @@ -294,8 +290,7 @@ class ACHelper { minHeight: 40.0, minWidth: 40.0, ), - isSelected: - conditions.map((c) => c == (currentCondition ?? "==")).toList(), + isSelected: conditions.map((c) => c == (currentCondition ?? "==")).toList(), children: conditions.map((c) => Text(c)).toList(), ); } @@ -333,10 +328,10 @@ class ACHelper { String selectCode, ) { return Slider( - value: initialValue is int ? initialValue.toDouble() : 160.0, - min: 160, + value: initialValue is int ? initialValue.toDouble() : 200.0, + min: 200, max: 300, - divisions: 14, + divisions: 10, label: '${((initialValue ?? 160) / 10).toInt()}°C', onChanged: (value) { context.read().add( @@ -389,13 +384,9 @@ class ACHelper { style: context.textTheme.bodyMedium, ), trailing: Icon( - isSelected - ? Icons.radio_button_checked - : Icons.radio_button_unchecked, + isSelected ? Icons.radio_button_checked : Icons.radio_button_unchecked, size: 24, - color: isSelected - ? ColorsManager.primaryColorWithOpacity - : ColorsManager.textGray, + color: isSelected ? ColorsManager.primaryColorWithOpacity : ColorsManager.textGray, ), onTap: () { if (!isSelected) { @@ -407,8 +398,7 @@ class ACHelper { operationName: operationName, value: value.value, condition: selectedFunctionData?.condition, - valueDescription: - selectedFunctionData?.valueDescription, + valueDescription: selectedFunctionData?.valueDescription, ), ), );