CAKE-345 | merged CAKE-349 branch into current

This commit is contained in:
OleksandrSobol 2021-08-16 11:30:48 +03:00
parent 3967cc8d40
commit a5831a25e7
4 changed files with 15 additions and 25 deletions

View file

@ -16,24 +16,12 @@ double bitcoinAmountToDouble({int amount}) =>
cryptoAmountToDouble(amount: amount, divider: bitcoinAmountDivider);
int stringDoubleToBitcoinAmount(String amount) {
final splitted = amount.split('');
final dotIndex = amount.indexOf('.');
int result = 0;
for (var i = 0; i < splitted.length; i++) {
try {
if (dotIndex == i) {
continue;
}
final char = splitted[i];
final multiplier = dotIndex < i
? bitcoinAmountDivider ~/ pow(10, (i - dotIndex))
: (bitcoinAmountDivider * pow(10, (dotIndex - i -1))).toInt();
final num = int.parse(char) * multiplier;
result += num;
} catch (_) {}
try {
result = (double.parse(amount) * bitcoinAmountDivider).toInt();
} catch (e) {
result = 0;
}
return result;

View file

@ -165,11 +165,9 @@ class ExchangeCardState extends State<ExchangeCard> {
textAlign: TextAlign.left,
keyboardType: TextInputType.numberWithOptions(
signed: false, decimal: true),
// inputFormatters: [
// LengthLimitingTextInputFormatter(15),
// BlacklistingTextInputFormatter(
// RegExp('[\\-|\\ |\\,]'))
// ],
inputFormatters: [
FilteringTextInputFormatter.deny(RegExp('[\\-|\\ ]'))
],
hintText: '0.0000',
borderColor: widget.borderColor,
textStyle: TextStyle(

View file

@ -156,8 +156,7 @@ class SendTemplatePage extends BasePage {
keyboardType: TextInputType.numberWithOptions(
signed: false, decimal: true),
inputFormatters: [
BlacklistingTextInputFormatter(
RegExp('[\\-|\\ ]'))
FilteringTextInputFormatter.deny(RegExp('[\\-|\\ ]'))
],
prefixIcon: Padding(
padding: EdgeInsets.only(top: 9),
@ -196,8 +195,7 @@ class SendTemplatePage extends BasePage {
keyboardType: TextInputType.numberWithOptions(
signed: false, decimal: true),
inputFormatters: [
BlacklistingTextInputFormatter(
RegExp('[\\-|\\ ]'))
FilteringTextInputFormatter.deny(RegExp('[\\-|\\ ]'))
],
prefixIcon: Padding(
padding: EdgeInsets.only(top: 9),

View file

@ -164,6 +164,9 @@ class SendCardState extends State<SendCard>
keyboardType:
TextInputType.numberWithOptions(
signed: false, decimal: true),
inputFormatters: [
FilteringTextInputFormatter.deny(RegExp('[\\-|\\ ]'))
],
prefixIcon: Padding(
padding: EdgeInsets.only(top: 9),
child: Text(
@ -273,6 +276,9 @@ class SendCardState extends State<SendCard>
keyboardType:
TextInputType.numberWithOptions(
signed: false, decimal: true),
inputFormatters: [
FilteringTextInputFormatter.deny(RegExp('[\\-|\\ ]'))
],
prefixIcon: Padding(
padding: EdgeInsets.only(top: 9),
child: