mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-09 14:47:23 +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.maxValue,
|
||||||
required this.steps,
|
required this.steps,
|
||||||
this.description,
|
this.description,
|
||||||
|
this.valuesPercision = 0,
|
||||||
});
|
});
|
||||||
|
|
||||||
final String title;
|
final String title;
|
||||||
@ -22,6 +23,7 @@ class PresenceUpdateData extends StatefulWidget {
|
|||||||
final double steps;
|
final double steps;
|
||||||
final Function action;
|
final Function action;
|
||||||
final String? description;
|
final String? description;
|
||||||
|
final int valuesPercision;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<PresenceUpdateData> createState() => _CurrentTempState();
|
State<PresenceUpdateData> createState() => _CurrentTempState();
|
||||||
@ -45,7 +47,7 @@ class _CurrentTempState extends State<PresenceUpdateData> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void _onValueChanged(double newValue) {
|
void _onValueChanged(double newValue) {
|
||||||
widget.action(newValue.toInt());
|
widget.action(newValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -66,7 +68,7 @@ class _CurrentTempState extends State<PresenceUpdateData> {
|
|||||||
color: ColorsManager.blackColor, fontWeight: FontWeight.w400, fontSize: 10),
|
color: ColorsManager.blackColor, fontWeight: FontWeight.w400, fontSize: 10),
|
||||||
),
|
),
|
||||||
IncrementDecrementWidget(
|
IncrementDecrementWidget(
|
||||||
value: widget.value.toString(),
|
value: widget.value.toStringAsFixed(widget.valuesPercision),
|
||||||
description: widget.description ?? '',
|
description: widget.description ?? '',
|
||||||
descriptionColor: ColorsManager.blackColor,
|
descriptionColor: ColorsManager.blackColor,
|
||||||
onIncrement: () {
|
onIncrement: () {
|
||||||
|
Reference in New Issue
Block a user