Truncate to double (#511)

* Truncate to double

* fix format remaining amount
This commit is contained in:
Godwin Asuquo
2022-09-19 11:09:23 -04:00
committed by GitHub
parent 54bc40c503
commit c921ad890a
2 changed files with 4 additions and 1 deletions
@@ -117,7 +117,7 @@ class IoniaCustomRedeemPage extends BasePage {
Observer(builder: (_)=>
!ioniaCustomRedeemViewModel.disableRedeem ?
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(
color: Theme.of(context).primaryTextTheme.headline.color,
),),
@@ -16,6 +16,9 @@ abstract class IoniaCustomRedeemViewModelBase with Store {
@computed
double get remaining => amount <= giftCard.remainingAmount ? giftCard.remainingAmount - amount : 0;
@computed
String get formattedRemaining => remaining.toStringAsFixed(2);
@computed
bool get disableRedeem => amount > giftCard.remainingAmount;