mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-09 06:37:20 +00:00
Refactor PresenceUpdateData
widget to support decimal values.
This commit is contained in:
@ -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: () {
|
||||
|
Reference in New Issue
Block a user