fix: numformat

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-03-06 13:12:55 +08:00
parent 973dad4176
commit 737b7d0507

View File

@@ -1060,12 +1060,12 @@ class Utils {
}
String format(first, second) {
double result = number / first;
String format = result.toStringAsFixed(1);
if (format.endsWith('.0')) {
return '${result.toInt()}$second';
double result = ((number / first) as double).toPrecision(1);
int intRes = result.toInt();
if (result == intRes) {
return '$intRes$second';
} else {
return '$format$second';
return '$result$second';
}
}