mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +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) {
|
||||
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';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user