mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-10 07:07:19 +00:00
Refactor wall presence sensor components and add new widgets for improved functionality and clarity to ensure reusability in the future for other devices.
This commit is contained in:
26
lib/pages/routines/widgets/function_slider.dart
Normal file
26
lib/pages/routines/widgets/function_slider.dart
Normal file
@ -0,0 +1,26 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class FunctionSlider extends StatelessWidget {
|
||||
final dynamic initialValue;
|
||||
|
||||
final (double min, double max) range;
|
||||
final void Function(double value) onChanged;
|
||||
|
||||
const FunctionSlider({
|
||||
required this.onChanged,
|
||||
required this.initialValue,
|
||||
required this.range,
|
||||
super.key,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Slider(
|
||||
value: initialValue is int ? initialValue.toDouble() : range.$1,
|
||||
min: range.$1,
|
||||
max: range.$2,
|
||||
divisions: (range.$2 - range.$1).toInt(),
|
||||
onChanged: onChanged,
|
||||
);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user