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:
malik1004x
2026-03-18 22:34:02 +01:00
committed by GitHub
parent 410c496bfc
commit 24cceb5795
8 changed files with 151 additions and 109 deletions
+12 -3
View File
@@ -2,6 +2,7 @@ import 'package:cake_wallet/entities/bitcoin_amount_display_mode.dart';
import 'package:cake_wallet/src/screens/wallet_connect/utils/string_parsing.dart';
import 'package:cw_core/crypto_amount_format.dart';
import 'package:cw_core/crypto_currency.dart';
import 'package:cw_core/utils/print_verbose.dart';
class AmountParsingProxy {
final BitcoinAmountDisplayMode displayMode;
@@ -19,11 +20,19 @@ class AmountParsingProxy {
/// [getCryptoOutputAmount] turns the input [amount] into the preferred representation of [cryptoCurrency]
String getDisplayCryptoAmount(String amount, CryptoCurrency cryptoCurrency) {
if (useSatoshi(cryptoCurrency) && amount.isNotEmpty) {
return cryptoCurrency.parseAmount(amount.withMaxDecimals(cryptoCurrency.decimals)).toString();
try {
if (useSatoshi(cryptoCurrency) && amount.isNotEmpty) {
return cryptoCurrency.parseAmount(amount.withMaxDecimals(cryptoCurrency.decimals)).toString();
}
return amount.withMaxDecimals(cryptoCurrency.decimals);
} catch(_) {
printV("failed to parse amount $amount for currency ${cryptoCurrency.title}, falling back to showing unparsed");
return amount;
}
return amount.withMaxDecimals(cryptoCurrency.decimals);
}
/// [getCryptoStringRepresentation] turns the input [amount] into the preferred representation of [cryptoCurrency]