Truncate to double (#511)

* Truncate to double

* fix format remaining amount
This commit is contained in:
Godwin Asuquo 2022-09-19 18:09:23 +03:00 committed by GitHub
parent 54bc40c503
commit c921ad890a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 1 deletions

View file

@ -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,
),),

View file

@ -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;