fix buy sell fiat calculation (#1930)

* fix buy sell fiat calculation * skip IsReadyToTrade reaction * Update lib/src/screens/buy/buy_sell_page.dart [skip ci] --------- Co-authored-by: Omar Hatem <omarh.ismail1@gmail.com>

Serhii committed Jan 3, 2025 at 22:29 UTC bc80fa68df00064aed5e52bfcb04185828de1bd2
2 files changed +8
lib/src/screens/buy/buy_sell_page.dart
+4
@@ -312,6 +312,10 @@ class BuySellPage extends BasePage {
312
313 reaction((_) => buySellViewModel.isReadyToTrade, (bool isReady) {
314 if (isReady) {
315 + if (buySellViewModel.skipIsReadyToTradeReaction) {
316 + buySellViewModel.skipIsReadyToTradeReaction = false;
317 + return;
318 + }
319 if (cryptoAmountController.text.isNotEmpty &&
320 cryptoAmountController.text != S.current.fetching) {
321 buySellViewModel.changeCryptoAmount(amount: cryptoAmountController.text);
lib/view_model/buy/buy_sell_view_model.dart
+4
@@ -149,6 +149,9 @@ abstract class BuySellViewModelBase extends WalletChangeListenerViewModel with S
149 @observable
150 BuySellQuotLoadingState buySellQuotState;
151
152 + @observable
153 + bool skipIsReadyToTradeReaction = false;
154 +
155 @computed
156 bool get isReadyToTrade {
157 final hasSelectedQuote = selectedQuote != null;
@@ -266,6 +269,7 @@ abstract class BuySellViewModelBase extends WalletChangeListenerViewModel with S
269 }
270
271 void onTapChoseProvider(BuildContext context) async {
272 + skipIsReadyToTradeReaction = true;
273 final initialQuotes = List<Quote>.from(sortedRecommendedQuotes + sortedQuotes);
274 await calculateBestRate();
275 final newQuotes = (sortedRecommendedQuotes + sortedQuotes);