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) { 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';
} }
} }