diff --git a/lib/pages/routines/widgets/routine_dialogs/ceiling_sensor/ceiling_sensor_dialog.dart b/lib/pages/routines/widgets/routine_dialogs/ceiling_sensor/ceiling_sensor_dialog.dart index 52665dfa..e54f348e 100644 --- a/lib/pages/routines/widgets/routine_dialogs/ceiling_sensor/ceiling_sensor_dialog.dart +++ b/lib/pages/routines/widgets/routine_dialogs/ceiling_sensor/ceiling_sensor_dialog.dart @@ -153,23 +153,27 @@ class _CeilingSensorDialogState extends State { ); } + static const _mappableSteppedFunctions = { + 'static_max_dis', + 'presence_reference', + 'moving_reference', + 'perceptual_boundary', + 'moving_boundary', + 'moving_rigger_time', + 'moving_static_time', + 'none_body_time', + 'moving_max_dis', + }; + List _updateValuesForAddedFunctions( List addedFunctions, ) { - const mappableSteppedFunctions = { - 'static_max_dis', - 'presence_reference', - 'moving_reference', - 'perceptual_boundary', - 'moving_boundary', - 'moving_rigger_time', - 'moving_static_time', - 'none_body_time', - 'moving_max_dis', - }; return addedFunctions.map((function) { - if (mappableSteppedFunctions.contains(function.functionCode)) { - final mappedValue = mapSteppedValue( + final shouldMapValue = _mappableSteppedFunctions.contains( + function.functionCode, + ); + if (shouldMapValue) { + final mappedValue = _mapSteppedValue( value: function.value, inputStep: CpsSliderHelpers.dividendOfRange(function.functionCode), inputRange: CpsSliderHelpers.sliderRange(function.functionCode), @@ -189,7 +193,7 @@ class _CeilingSensorDialogState extends State { }).toList(); } - int mapSteppedValue({ + int _mapSteppedValue({ required (double min, double max) inputRange, required double inputStep, required (double min, double max, double dividend) outputRange,