mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-01-23 19:16:09 +00:00
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>
This commit is contained in:
parent
471a2af527
commit
bc80fa68df
2 changed files with 8 additions and 0 deletions
|
@ -312,6 +312,10 @@ class BuySellPage extends BasePage {
|
||||||
|
|
||||||
reaction((_) => buySellViewModel.isReadyToTrade, (bool isReady) {
|
reaction((_) => buySellViewModel.isReadyToTrade, (bool isReady) {
|
||||||
if (isReady) {
|
if (isReady) {
|
||||||
|
if (buySellViewModel.skipIsReadyToTradeReaction) {
|
||||||
|
buySellViewModel.skipIsReadyToTradeReaction = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (cryptoAmountController.text.isNotEmpty &&
|
if (cryptoAmountController.text.isNotEmpty &&
|
||||||
cryptoAmountController.text != S.current.fetching) {
|
cryptoAmountController.text != S.current.fetching) {
|
||||||
buySellViewModel.changeCryptoAmount(amount: cryptoAmountController.text);
|
buySellViewModel.changeCryptoAmount(amount: cryptoAmountController.text);
|
||||||
|
|
|
@ -149,6 +149,9 @@ abstract class BuySellViewModelBase extends WalletChangeListenerViewModel with S
|
||||||
@observable
|
@observable
|
||||||
BuySellQuotLoadingState buySellQuotState;
|
BuySellQuotLoadingState buySellQuotState;
|
||||||
|
|
||||||
|
@observable
|
||||||
|
bool skipIsReadyToTradeReaction = false;
|
||||||
|
|
||||||
@computed
|
@computed
|
||||||
bool get isReadyToTrade {
|
bool get isReadyToTrade {
|
||||||
final hasSelectedQuote = selectedQuote != null;
|
final hasSelectedQuote = selectedQuote != null;
|
||||||
|
@ -266,6 +269,7 @@ abstract class BuySellViewModelBase extends WalletChangeListenerViewModel with S
|
||||||
}
|
}
|
||||||
|
|
||||||
void onTapChoseProvider(BuildContext context) async {
|
void onTapChoseProvider(BuildContext context) async {
|
||||||
|
skipIsReadyToTradeReaction = true;
|
||||||
final initialQuotes = List<Quote>.from(sortedRecommendedQuotes + sortedQuotes);
|
final initialQuotes = List<Quote>.from(sortedRecommendedQuotes + sortedQuotes);
|
||||||
await calculateBestRate();
|
await calculateBestRate();
|
||||||
final newQuotes = (sortedRecommendedQuotes + sortedQuotes);
|
final newQuotes = (sortedRecommendedQuotes + sortedQuotes);
|
||||||
|
|
Loading…
Reference in a new issue