mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-06-01 00:28:18 +08:00
fix: numformat
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -1060,12 +1060,12 @@ class Utils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String format(first, second) {
|
String format(first, second) {
|
||||||
double result = number / first;
|
double result = ((number / first) as double).toPrecision(1);
|
||||||
String format = result.toStringAsFixed(1);
|
int intRes = result.toInt();
|
||||||
if (format.endsWith('.0')) {
|
if (result == intRes) {
|
||||||
return '${result.toInt()}$second';
|
return '$intRes$second';
|
||||||
} else {
|
} else {
|
||||||
return '$format$second';
|
return '$result$second';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user