Cw 262 better handle user exchange amount below minimum or maximum trade size (#868)

* CW-262-Better-handle-user-exchange-amount-below-minimum-or-maximum-trade-size

* fix: App should compute conversion even if it's not within the limits
This commit is contained in:
Adegoke David
2023-04-20 03:13:37 +02:00
committed by GitHub
parent efef30f8eb
commit 7b91b0e938
26 changed files with 185 additions and 12 deletions
+22 -8
View File
@@ -456,8 +456,7 @@ class ExchangePage extends BasePage {
depositAmountController.addListener(() {
if (depositAmountController.text != exchangeViewModel.depositAmount) {
_depositAmountDebounce.run(() {
exchangeViewModel.changeDepositAmount(
amount: depositAmountController.text);
exchangeViewModel.changeDepositAmount(amount: depositAmountController.text);
exchangeViewModel.isReceiveAmountEntered = false;
});
}
@@ -469,8 +468,7 @@ class ExchangePage extends BasePage {
receiveAmountController.addListener(() {
if (receiveAmountController.text != exchangeViewModel.receiveAmount) {
_receiveAmountDebounce.run(() {
exchangeViewModel.changeReceiveAmount(
amount: receiveAmountController.text);
exchangeViewModel.changeReceiveAmount(amount: receiveAmountController.text);
exchangeViewModel.isReceiveAmountEntered = true;
});
}
@@ -626,8 +624,16 @@ class ExchangePage extends BasePage {
currencyButtonColor: Colors.transparent,
addressButtonsColor: Theme.of(context).focusColor!,
borderColor: Theme.of(context).primaryTextTheme!.bodyText1!.color!,
currencyValueValidator:
AmountValidator(currency: exchangeViewModel.depositCurrency),
currencyValueValidator: (value) {
return !exchangeViewModel.isFixedRateMode
? AmountValidator(
isAutovalidate: true,
currency: exchangeViewModel.depositCurrency,
minValue: exchangeViewModel.limits.min.toString(),
maxValue: exchangeViewModel.limits.max.toString(),
).call(value)
: null;
},
addressTextFieldValidator:
AddressValidator(type: exchangeViewModel.depositCurrency),
onPushPasteButton: (context) async {
@@ -668,8 +674,16 @@ class ExchangePage extends BasePage {
addressButtonsColor: Theme.of(context).focusColor!,
borderColor:
Theme.of(context).primaryTextTheme!.bodyText1!.decorationColor!,
currencyValueValidator:
AmountValidator(currency: exchangeViewModel.receiveCurrency),
currencyValueValidator: (value) {
return exchangeViewModel.isFixedRateMode
? AmountValidator(
isAutovalidate: true,
currency: exchangeViewModel.receiveCurrency,
minValue: exchangeViewModel.limits.min.toString(),
maxValue: exchangeViewModel.limits.max.toString(),
).call(value)
: null;
},
addressTextFieldValidator:
AddressValidator(type: exchangeViewModel.receiveCurrency),
onPushPasteButton: (context) async {