From 8bbaa3fef0d4c986f051a0c1b2a41644691a8b01 Mon Sep 17 00:00:00 2001 From: Robert Malikowski Date: Fri, 11 Sep 2026 13:07:06 +0200 Subject: [PATCH] tiny review fixes --- .../pages/buy_sell/buy_sell_amount_page.dart | 1 + lib/view_model/buy/buy_sell_view_model.dart | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/lib/new-ui/pages/buy_sell/buy_sell_amount_page.dart b/lib/new-ui/pages/buy_sell/buy_sell_amount_page.dart index c7031c8d6..951e24674 100644 --- a/lib/new-ui/pages/buy_sell/buy_sell_amount_page.dart +++ b/lib/new-ui/pages/buy_sell/buy_sell_amount_page.dart @@ -290,6 +290,7 @@ class BuySellCustomAmountInput extends StatelessWidget { Padding( padding: const EdgeInsets.all(18), child: NewPrimaryButton( + disabled: controller.text.isEmpty, onPressed: onContinuePressed, isLoading: isLoading, text: S.of(context).continue_text, diff --git a/lib/view_model/buy/buy_sell_view_model.dart b/lib/view_model/buy/buy_sell_view_model.dart index 048e61628..e936ca4ba 100644 --- a/lib/view_model/buy/buy_sell_view_model.dart +++ b/lib/view_model/buy/buy_sell_view_model.dart @@ -96,10 +96,21 @@ abstract class BuySellViewModelBase extends WalletChangeListenerViewModel with S // sets based on the absolute amout (from the fiat/charts api) // works even if you have no rates - Future setCryptoAmountFromFiat(String fiatAmount) async => changeCryptoAmount( - amount: (double.parse(fiatAmount) / (fiatConversionStore.prices[cryptoCurrency] ?? 0)) + Future setCryptoAmountFromFiat(String fiatAmount) async { + if(fiatAmount.isEmpty) { + await changeCryptoAmount(amount: ""); + return; + } + + if(fiatConversionStore.prices[cryptoCurrency] == null) { + return; + } + + await changeCryptoAmount( + amount: (double.parse(fiatAmount) / (fiatConversionStore.prices[cryptoCurrency]!)) .toString(), ); + } final AppStore _appStore;