mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-12-02 12:14:09 +01:00
fix ui edge cases (#3109)
* wrap navbar in observer to account for disabling pages * always display fiat amount with 2 decimals on confirm sheet * don't show limit popup if max limit is 0 (this signifies the providers didn't load yet) * fix deposit amount getting set to "ALL" in race condition * disable showing hardware wallets on l2 wallet selector * fix reset in account customizer if designs weren't loaded properly * add withDecimals string extension * add fallback on failed display amount parse
This commit is contained in:
@@ -17,6 +17,26 @@ extension MaxDecimals on String {
|
||||
return parts.join(".");
|
||||
}
|
||||
|
||||
String withDecimals(int decimals) {
|
||||
var parts = split(".");
|
||||
|
||||
if (parts.length > 2) {
|
||||
parts = [parts.first, parts.sublist(1).join("")];
|
||||
}
|
||||
|
||||
if (parts.length == 1) {
|
||||
parts.add("");
|
||||
}
|
||||
|
||||
if (parts[1].length > decimals) {
|
||||
parts[1] = parts[1].substring(0, decimals);
|
||||
} else {
|
||||
parts[1] = parts[1].padRight(decimals, '0');
|
||||
}
|
||||
|
||||
return parts.join(".");
|
||||
}
|
||||
|
||||
|
||||
/// Format a stringified number to a localized representation
|
||||
/// 1.000.000,00 in de_DE
|
||||
|
||||
Reference in New Issue
Block a user