Truncate to double (#511)
* Truncate to double * fix format remaining amount
Godwin Asuquo committed
Sep 19, 2022 at 18:09 UTC
c921ad890a00bd700f96716eb01f39a09d20b266
2 files changed
+4
-1
lib/src/screens/ionia/cards/ionia_custom_redeem_page.dart
+1
-1
@@ -117,7 +117,7 @@ class IoniaCustomRedeemPage extends BasePage {
117
Observer(builder: (_)=>
118
!ioniaCustomRedeemViewModel.disableRedeem ?
119
Center(
120
- child: Text('\$${giftCard.remainingAmount} - \$${ioniaCustomRedeemViewModel.amount} = \$${ioniaCustomRedeemViewModel.remaining} ${S.of(context).remaining}',
120
+ child: Text('\$${giftCard.remainingAmount} - \$${ioniaCustomRedeemViewModel.amount} = \$${ioniaCustomRedeemViewModel.formattedRemaining} ${S.of(context).remaining}',
121
style: TextStyle(
122
color: Theme.of(context).primaryTextTheme.headline.color,
123
),),
lib/view_model/ionia/ionia_custom_redeem_view_model.dart
+3
@@ -16,6 +16,9 @@ abstract class IoniaCustomRedeemViewModelBase with Store {
16
@computed
17
double get remaining => amount <= giftCard.remainingAmount ? giftCard.remainingAmount - amount : 0;
18
19
+ @computed
20
+ String get formattedRemaining => remaining.toStringAsFixed(2);
21
+
22
@computed
23
bool get disableRedeem => amount > giftCard.remainingAmount;
24