mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-11-17 01:37:40 +00:00
Merge pull request #121 from cake-tech/CAKE-116-all-button-validation-bug
CAKE-116 | added AllAmountValidator class to the amount_validator.dar…
This commit is contained in:
commit
57eaeb547b
3 changed files with 17 additions and 4 deletions
|
@ -23,3 +23,11 @@ class AmountValidator extends TextValidator {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
class AllAmountValidator extends TextValidator {
|
||||
AllAmountValidator() : super(
|
||||
errorMessage: S.current.error_text_amount,
|
||||
pattern: S.current.all,
|
||||
minLength: 0,
|
||||
maxLength: 0);
|
||||
}
|
||||
|
|
|
@ -163,7 +163,7 @@ class SendPage extends BasePage {
|
|||
.decorationColor),
|
||||
validator: sendViewModel.addressValidator,
|
||||
),
|
||||
Padding(
|
||||
Observer(builder: (_) => Padding(
|
||||
padding: const EdgeInsets.only(top: 20),
|
||||
child: BaseTextFormField(
|
||||
focusNode: _cryptoAmountFocus,
|
||||
|
@ -226,7 +226,9 @@ class SendPage extends BasePage {
|
|||
fontWeight: FontWeight.w500,
|
||||
fontSize: 14),
|
||||
validator:
|
||||
sendViewModel.amountValidator)),
|
||||
sendViewModel.sendAll
|
||||
? sendViewModel.allAmountValidator
|
||||
: sendViewModel.amountValidator))),
|
||||
Observer(
|
||||
builder: (_) => Padding(
|
||||
padding: EdgeInsets.only(top: 10),
|
||||
|
@ -513,6 +515,7 @@ class SendPage extends BasePage {
|
|||
final amount = _fiatAmountController.text;
|
||||
|
||||
if (amount != sendViewModel.fiatAmount) {
|
||||
sendViewModel.sendAll = false;
|
||||
sendViewModel.setFiatAmount(amount);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -67,6 +67,8 @@ abstract class SendViewModelBase with Store {
|
|||
|
||||
Validator get amountValidator => AmountValidator(type: _wallet.type);
|
||||
|
||||
Validator get allAmountValidator => AllAmountValidator();
|
||||
|
||||
Validator get addressValidator => AddressValidator(type: _wallet.currency);
|
||||
|
||||
Validator get templateValidator => TemplateValidator();
|
||||
|
|
Loading…
Reference in a new issue