- Refactor the WpsFunctions class in wps_functions.dart to use 'cm' instead of 'temp' for the description of operational values.

- Update the WallPresenceSensor class in wall_presence_sensor.dart to use the selected operation name
This commit is contained in:
mohammad
2025-04-07 14:27:36 +03:00
parent ca44f3bf55
commit d264409d29
2 changed files with 7 additions and 10 deletions

View File

@ -244,11 +244,12 @@ class CurrentDistanceFunction extends WpsFunctions {
@override
List<WpsOperationalValue> getOperationalValues() {
List<WpsOperationalValue> values = [];
for (int temp = min; temp <= max; temp += step) {
for (int cm = min; cm <= max; cm += step) {
values.add(WpsOperationalValue(
icon: Assets.assetsTempreture,
description: "${temp}CM",
value: temp,
description: "${cm}CM",
value: cm,
));
}
return values;

View File

@ -13,7 +13,6 @@ import 'package:syncrow_web/utils/extension/build_context_x.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:syncrow_web/pages/routines/bloc/functions_bloc/functions_bloc_bloc.dart';
class WallPresenceSensor extends StatefulWidget {
final List<DeviceFunction> functions;
final AllDevicesModel? device;
@ -171,7 +170,7 @@ class _WallPresenceSensorState extends State<WallPresenceSensor> {
orElse: () => DeviceFunctionData(
entityId: '',
functionCode: selectedFunction,
operationName: '',
operationName: state.selectedOperationName!,
value: null,
),
);
@ -251,11 +250,8 @@ class _ValueSelector extends StatelessWidget {
);
}
bool _isSliderFunction(String function) => [
'dis_current',
'presence_time',
'illuminance_value'
].contains(function);
bool _isSliderFunction(String function) =>
['dis_current', 'presence_time', 'illuminance_value'].contains(function);
}
class _SliderValueSelector extends StatelessWidget {