Refactor PresenceUpdateData widget to support decimal values.

This commit is contained in:
Faris Armoush
2025-04-23 10:23:28 +03:00
parent 8c637e40ff
commit 367d6717e7

View File

@ -13,6 +13,7 @@ class PresenceUpdateData extends StatefulWidget {
required this.maxValue,
required this.steps,
this.description,
this.valuesPercision = 0,
});
final String title;
@ -22,6 +23,7 @@ class PresenceUpdateData extends StatefulWidget {
final double steps;
final Function action;
final String? description;
final int valuesPercision;
@override
State<PresenceUpdateData> createState() => _CurrentTempState();
@ -45,7 +47,7 @@ class _CurrentTempState extends State<PresenceUpdateData> {
}
void _onValueChanged(double newValue) {
widget.action(newValue.toInt());
widget.action(newValue);
}
@override
@ -66,7 +68,7 @@ class _CurrentTempState extends State<PresenceUpdateData> {
color: ColorsManager.blackColor, fontWeight: FontWeight.w400, fontSize: 10),
),
IncrementDecrementWidget(
value: widget.value.toString(),
value: widget.value.toStringAsFixed(widget.valuesPercision),
description: widget.description ?? '',
descriptionColor: ColorsManager.blackColor,
onIncrement: () {