mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-01-09 04:19:36 +00:00
CAKE-185 | changed isValidAmount() in the exchange_view_model.dart
This commit is contained in:
parent
4cb4ede2d3
commit
623299b8f6
1 changed files with 2 additions and 9 deletions
|
@ -313,15 +313,8 @@ abstract class ExchangeViewModelBase with Store {
|
||||||
final amount = isReceiveAmountEntered
|
final amount = isReceiveAmountEntered
|
||||||
? receiveAmount
|
? receiveAmount
|
||||||
: depositAmount;
|
: depositAmount;
|
||||||
|
isValid = RegExp('^([0-9]+([.\,][0-9]{0,8})?|[.\,][0-9]{1,8})\$')
|
||||||
final amountParts = amount.replaceAll(',', '.')
|
.hasMatch(amount);
|
||||||
.split('.');
|
|
||||||
|
|
||||||
final numberOfFractionDigits =
|
|
||||||
amountParts.length > 1
|
|
||||||
? amountParts[1].length : 0;
|
|
||||||
|
|
||||||
isValid = !(numberOfFractionDigits > 8);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return isValid;
|
return isValid;
|
||||||
|
|
Loading…
Reference in a new issue