CAKE-278 | applied fixed rate mode only for pair xmr-btc; added _defineIsReceiveAmountEditable() to exchange_view_model.dart; added reaction on isReceiveAmountEditable to exchange_page.dart

This commit is contained in:
OleksandrSobol
2021-02-23 19:36:03 +02:00
parent ae96213aad
commit fc70852002
2 changed files with 86 additions and 78 deletions
@@ -57,10 +57,8 @@ abstract class ExchangeViewModelBase with Store {
_onPairChange();
}
});
isReceiveAmountEditable = provider is ChangeNowExchangeProvider;
_defineIsReceiveAmountEditable();
isFixedRateMode = false;
isReceiveAmountEntered = false;
loadLimits();
}
@@ -136,8 +134,8 @@ abstract class ExchangeViewModelBase with Store {
this.provider = provider;
depositAmount = '';
receiveAmount = '';
isReceiveAmountEditable = provider is ChangeNowExchangeProvider;
isFixedRateMode = false;
_defineIsReceiveAmountEditable();
loadLimits();
}
@@ -380,7 +378,7 @@ abstract class ExchangeViewModelBase with Store {
}
}
depositAddress = depositCurrency == wallet.currency ? wallet.address : '';
_defineIsReceiveAmountEditable();
depositAmount = '';
receiveAmount = '';
loadLimits();
@@ -405,4 +403,14 @@ abstract class ExchangeViewModelBase with Store {
break;
}
}
void _defineIsReceiveAmountEditable() {
if ((provider is ChangeNowExchangeProvider)
&&(depositCurrency == CryptoCurrency.xmr)
&&(receiveCurrency == CryptoCurrency.btc)) {
isReceiveAmountEditable = true;
} else {
isReceiveAmountEditable = false;
}
}
}