mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-09 22:57:21 +00:00
68 lines
2.3 KiB
Dart
68 lines
2.3 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:syncrow_web/pages/device_managment/all_devices/models/devices_model.dart';
|
|
import 'package:syncrow_web/pages/routines/models/device_functions.dart';
|
|
import 'package:syncrow_web/pages/routines/widgets/condition_toggle.dart';
|
|
import 'package:syncrow_web/pages/routines/widgets/function_slider.dart';
|
|
import 'package:syncrow_web/pages/routines/widgets/value_display.dart';
|
|
|
|
class SliderValueSelector extends StatelessWidget {
|
|
final String selectedFunction;
|
|
final DeviceFunctionData functionData;
|
|
final AllDevicesModel? device;
|
|
final String dialogType;
|
|
final (double, double) sliderRange;
|
|
final String displayedValue;
|
|
final Object? initialValue;
|
|
final void Function(String condition) onConditionChanged;
|
|
final void Function(double value) onSliderChanged;
|
|
|
|
const SliderValueSelector({
|
|
required this.selectedFunction,
|
|
required this.functionData,
|
|
required this.device,
|
|
required this.dialogType,
|
|
required this.sliderRange,
|
|
required this.displayedValue,
|
|
required this.initialValue,
|
|
required this.onConditionChanged,
|
|
required this.onSliderChanged,
|
|
super.key,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Column(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
const SizedBox(height: 20),
|
|
ConditionToggle(
|
|
currentCondition: functionData.condition,
|
|
onChanged: onConditionChanged,
|
|
),
|
|
ValueDisplay(
|
|
value: initialValue,
|
|
label: displayedValue,
|
|
),
|
|
const SizedBox(height: 20),
|
|
FunctionSlider(
|
|
initialValue: initialValue,
|
|
range: sliderRange, onChanged: onSliderChanged,
|
|
// void _updateValue(BuildContext context, int value) {
|
|
// context.read<FunctionBloc>().add(
|
|
// AddFunction(
|
|
// functionData: DeviceFunctionData(
|
|
// entityId: device?.uuid ?? '',
|
|
// functionCode: functionCode,
|
|
// operationName: functionData.operationName,
|
|
// value: value,
|
|
// condition: functionData.condition,
|
|
// ),
|
|
// ),
|
|
// );
|
|
// }
|
|
),
|
|
],
|
|
);
|
|
}
|
|
}
|