Update avaibility status for ionia merch. (#443)

This commit is contained in:
mkyq 2022-07-28 19:03:53 +01:00 committed by GitHub
parent 418c9563fe
commit b777dd9e7b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 16 deletions

View file

@ -1,5 +1,6 @@
import 'package:flutter/foundation.dart';
import 'package:cake_wallet/ionia/ionia_gift_card_instruction.dart';
import 'package:cake_wallet/generated/i18n.dart';
class IoniaMerchant {
IoniaMerchant({
@ -173,4 +174,22 @@ class IoniaMerchant {
double get discount => savingsPercentage;
String get avaibilityStatus {
var status = '';
if (isOnline) {
status += S.current.online;
}
if (isPhysical) {
if (status.isNotEmpty) {
status = '$status & ';
}
status = '${status}${S.current.in_store}';
}
return status;
}
}

View file

@ -149,7 +149,7 @@ class IoniaBuyGiftCardPage extends BasePage {
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,
subTitle: merchant.avaibilityStatus,
logoUrl: merchant.logoUrl,
),
)

View file

@ -216,27 +216,13 @@ 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: subTitle,
subTitle: merchant.avaibilityStatus,
backgroundColor: Theme.of(context).textTheme.title.backgroundColor,
titleColor: Theme.of(context).accentTextTheme.display3.backgroundColor,
subtitleColor: Theme.of(context).accentTextTheme.display2.backgroundColor,