CAKE-185 | changed isValidAmount() in the exchange_view_model.dart

This commit is contained in:
OleksandrSobol 2020-11-27 08:50:28 +02:00
parent 4cb4ede2d3
commit 623299b8f6

View file

@ -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;