mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-01-08 20:09:24 +00:00
Update for discounts and statuses for ionia merch.
This commit is contained in:
parent
0c8caf8847
commit
8bd66b64e7
5 changed files with 25 additions and 6 deletions
|
@ -168,5 +168,7 @@ class IoniaMerchant {
|
|||
final String acceptedCurrency;
|
||||
final String deepLink;
|
||||
final bool isPayLater;
|
||||
|
||||
double get discount => level3;
|
||||
|
||||
}
|
||||
|
|
|
@ -35,8 +35,8 @@ class IoniaBuyGiftCardDetailPage extends BasePage {
|
|||
|
||||
@override
|
||||
Widget trailing(BuildContext context)
|
||||
=> ioniaPurchaseViewModel.ioniaMerchant.minimumDiscount > 0
|
||||
? DiscountBadge(percentage: ioniaPurchaseViewModel.ioniaMerchant.minimumDiscount)
|
||||
=> ioniaPurchaseViewModel.ioniaMerchant.discount > 0
|
||||
? DiscountBadge(percentage: ioniaPurchaseViewModel.ioniaMerchant.discount)
|
||||
: null;
|
||||
|
||||
@override
|
||||
|
@ -130,7 +130,7 @@ class IoniaBuyGiftCardDetailPage extends BasePage {
|
|||
),
|
||||
SizedBox(height: 4),
|
||||
Text(
|
||||
'\$${ioniaPurchaseViewModel.amount.toStringAsFixed(2)}',
|
||||
'\$${ioniaPurchaseViewModel.billAmount.toStringAsFixed(2)}',
|
||||
style: textLargeSemiBold(),
|
||||
),
|
||||
],
|
||||
|
|
|
@ -146,7 +146,7 @@ class IoniaBuyGiftCardPage extends BasePage {
|
|||
child: CardItem(
|
||||
title: merchant.legalName,
|
||||
backgroundColor: Theme.of(context).accentTextTheme.display4.backgroundColor.withOpacity(0.1),
|
||||
discount: merchant.minimumDiscount,
|
||||
discount: merchant.discount,
|
||||
titleColor: Theme.of(context).accentTextTheme.display4.backgroundColor,
|
||||
subtitleColor: Theme.of(context).hintColor,
|
||||
subTitle: merchant.isOnline ? S.of(context).online : S.of(context).offline,
|
||||
|
|
|
@ -216,17 +216,31 @@ class _IoniaManageCardsPageBodyState extends State<IoniaManageCardsPageBody> {
|
|||
separatorBuilder: (_, __) => SizedBox(height: 4),
|
||||
itemBuilder: (_, index) {
|
||||
final merchant = merchantsList[index];
|
||||
var subTitle = '';
|
||||
|
||||
if (merchant.isOnline) {
|
||||
subTitle += S.of(context).online;
|
||||
}
|
||||
|
||||
if (merchant.isPhysical) {
|
||||
if (subTitle.isNotEmpty) {
|
||||
subTitle = '$subTitle & ';
|
||||
}
|
||||
|
||||
subTitle = '${subTitle}${S.of(context).in_store}';
|
||||
}
|
||||
|
||||
return CardItem(
|
||||
logoUrl: merchant.logoUrl,
|
||||
onTap: () {
|
||||
Navigator.of(context).pushNamed(Routes.ioniaBuyGiftCardPage, arguments: [merchant]);
|
||||
},
|
||||
title: merchant.legalName,
|
||||
subTitle: merchant.isOnline ? S.of(context).online : S.of(context).offline,
|
||||
subTitle: subTitle,
|
||||
backgroundColor: Theme.of(context).textTheme.title.backgroundColor,
|
||||
titleColor: Theme.of(context).accentTextTheme.display3.backgroundColor,
|
||||
subtitleColor: Theme.of(context).accentTextTheme.display2.backgroundColor,
|
||||
discount: merchant.minimumDiscount,
|
||||
discount: merchant.discount,
|
||||
);
|
||||
},
|
||||
),
|
||||
|
|
|
@ -58,6 +58,9 @@ abstract class IoniaMerchPurchaseViewModelBase with Store {
|
|||
@computed
|
||||
double get giftCardAmount => double.parse((amount + tipAmount).toStringAsFixed(2));
|
||||
|
||||
@computed
|
||||
double get billAmount => double.parse((giftCardAmount * (1 - (ioniaMerchant.discount / 100))).toStringAsFixed(2));
|
||||
|
||||
@observable
|
||||
double tipAmount;
|
||||
|
||||
|
|
Loading…
Reference in a new issue