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:
Faris Armoush
2025-04-10 14:32:09 +03:00
parent 9ca6fb8640
commit 9d3b58deeb
7 changed files with 372 additions and 347 deletions

View 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,
);
}
}