mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-01-09 04:19:36 +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});
|
const IoniaTip({this.originalAmount, this.percentage});
|
||||||
final double originalAmount;
|
final double originalAmount;
|
||||||
final double percentage;
|
final double percentage;
|
||||||
double get additionalAmount => originalAmount * percentage / 100;
|
double get additionalAmount => double.parse((originalAmount * percentage / 100).toStringAsFixed(2));
|
||||||
|
|
||||||
static const tipList = [
|
static const tipList = [
|
||||||
IoniaTip(originalAmount: 0, percentage: 0),
|
IoniaTip(originalAmount: 0, percentage: 0),
|
||||||
|
|
|
@ -85,7 +85,9 @@ class IoniaBuyGiftCardPage extends BasePage {
|
||||||
controller: _amountController,
|
controller: _amountController,
|
||||||
focusNode: _amountFieldFocus,
|
focusNode: _amountFieldFocus,
|
||||||
keyboardType: TextInputType.numberWithOptions(signed: false, decimal: true),
|
keyboardType: TextInputType.numberWithOptions(signed: false, decimal: true),
|
||||||
inputFormatters: [FilteringTextInputFormatter.deny(RegExp('[\-|\ ]'))],
|
inputFormatters: [
|
||||||
|
FilteringTextInputFormatter.deny(RegExp('[\-|\ ]')),
|
||||||
|
WhitelistingTextInputFormatter(RegExp(r'^\d+(\.|\,)?\d{0,2}'))],
|
||||||
hintText: '1000',
|
hintText: '1000',
|
||||||
placeholderTextStyle: TextStyle(
|
placeholderTextStyle: TextStyle(
|
||||||
color: Theme.of(context).primaryTextTheme.headline.color,
|
color: Theme.of(context).primaryTextTheme.headline.color,
|
||||||
|
|
|
@ -22,7 +22,7 @@ abstract class IoniaBuyCardViewModelBase with Store {
|
||||||
@action
|
@action
|
||||||
void onAmountChanged(String input) {
|
void onAmountChanged(String input) {
|
||||||
if (input.isEmpty) return;
|
if (input.isEmpty) return;
|
||||||
amount = double.parse(input);
|
amount = double.parse(input.replaceAll(',', '.'));
|
||||||
final min = ioniaMerchant.minimumCardPurchase;
|
final min = ioniaMerchant.minimumCardPurchase;
|
||||||
final max = ioniaMerchant.maximumCardPurchase;
|
final max = ioniaMerchant.maximumCardPurchase;
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,7 @@ abstract class IoniaMerchPurchaseViewModelBase with Store {
|
||||||
double percentage;
|
double percentage;
|
||||||
|
|
||||||
@computed
|
@computed
|
||||||
double get giftCardAmount => amount + tipAmount;
|
double get giftCardAmount => double.parse((amount + tipAmount).toStringAsFixed(2));
|
||||||
|
|
||||||
@observable
|
@observable
|
||||||
double tipAmount;
|
double tipAmount;
|
||||||
|
|
Loading…
Reference in a new issue