mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-12-22 19:49:22 +00:00
Truncate to double (#511)
* Truncate to double * fix format remaining amount
This commit is contained in:
parent
54bc40c503
commit
c921ad890a
2 changed files with 4 additions and 1 deletions
|
@ -117,7 +117,7 @@ class IoniaCustomRedeemPage extends BasePage {
|
||||||
Observer(builder: (_)=>
|
Observer(builder: (_)=>
|
||||||
!ioniaCustomRedeemViewModel.disableRedeem ?
|
!ioniaCustomRedeemViewModel.disableRedeem ?
|
||||||
Center(
|
Center(
|
||||||
child: Text('\$${giftCard.remainingAmount} - \$${ioniaCustomRedeemViewModel.amount} = \$${ioniaCustomRedeemViewModel.remaining} ${S.of(context).remaining}',
|
child: Text('\$${giftCard.remainingAmount} - \$${ioniaCustomRedeemViewModel.amount} = \$${ioniaCustomRedeemViewModel.formattedRemaining} ${S.of(context).remaining}',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Theme.of(context).primaryTextTheme.headline.color,
|
color: Theme.of(context).primaryTextTheme.headline.color,
|
||||||
),),
|
),),
|
||||||
|
|
|
@ -16,6 +16,9 @@ abstract class IoniaCustomRedeemViewModelBase with Store {
|
||||||
@computed
|
@computed
|
||||||
double get remaining => amount <= giftCard.remainingAmount ? giftCard.remainingAmount - amount : 0;
|
double get remaining => amount <= giftCard.remainingAmount ? giftCard.remainingAmount - amount : 0;
|
||||||
|
|
||||||
|
@computed
|
||||||
|
String get formattedRemaining => remaining.toStringAsFixed(2);
|
||||||
|
|
||||||
@computed
|
@computed
|
||||||
bool get disableRedeem => amount > giftCard.remainingAmount;
|
bool get disableRedeem => amount > giftCard.remainingAmount;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue