mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-01-08 11:59:23 +00:00
Fixes for fiat amounts for ionia.
This commit is contained in:
parent
effe163d82
commit
9d3e265392
4 changed files with 6 additions and 4 deletions
|
@ -2,7 +2,7 @@ class IoniaTip {
|
|||
const IoniaTip({this.originalAmount, this.percentage});
|
||||
final double originalAmount;
|
||||
final double percentage;
|
||||
double get additionalAmount => originalAmount * percentage / 100;
|
||||
double get additionalAmount => double.parse((originalAmount * percentage / 100).toStringAsFixed(2));
|
||||
|
||||
static const tipList = [
|
||||
IoniaTip(originalAmount: 0, percentage: 0),
|
||||
|
|
|
@ -85,7 +85,9 @@ class IoniaBuyGiftCardPage extends BasePage {
|
|||
controller: _amountController,
|
||||
focusNode: _amountFieldFocus,
|
||||
keyboardType: TextInputType.numberWithOptions(signed: false, decimal: true),
|
||||
inputFormatters: [FilteringTextInputFormatter.deny(RegExp('[\-|\ ]'))],
|
||||
inputFormatters: [
|
||||
FilteringTextInputFormatter.deny(RegExp('[\-|\ ]')),
|
||||
WhitelistingTextInputFormatter(RegExp(r'^\d+(\.|\,)?\d{0,2}'))],
|
||||
hintText: '1000',
|
||||
placeholderTextStyle: TextStyle(
|
||||
color: Theme.of(context).primaryTextTheme.headline.color,
|
||||
|
|
|
@ -22,7 +22,7 @@ abstract class IoniaBuyCardViewModelBase with Store {
|
|||
@action
|
||||
void onAmountChanged(String input) {
|
||||
if (input.isEmpty) return;
|
||||
amount = double.parse(input);
|
||||
amount = double.parse(input.replaceAll(',', '.'));
|
||||
final min = ioniaMerchant.minimumCardPurchase;
|
||||
final max = ioniaMerchant.maximumCardPurchase;
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ abstract class IoniaMerchPurchaseViewModelBase with Store {
|
|||
double percentage;
|
||||
|
||||
@computed
|
||||
double get giftCardAmount => amount + tipAmount;
|
||||
double get giftCardAmount => double.parse((amount + tipAmount).toStringAsFixed(2));
|
||||
|
||||
@observable
|
||||
double tipAmount;
|
||||
|
|
Loading…
Reference in a new issue