mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-01-09 04:19:36 +00:00
Fixes for instructions. Remove diplay error on payment status screen.
This commit is contained in:
parent
232ed8936f
commit
1cfd1df45b
7 changed files with 188 additions and 176 deletions
|
@ -159,9 +159,14 @@ class IoniaApi {
|
||||||
|
|
||||||
final data = decodedBody['Data'] as List<dynamic>;
|
final data = decodedBody['Data'] as List<dynamic>;
|
||||||
return data.map((dynamic e) {
|
return data.map((dynamic e) {
|
||||||
final element = e as Map<String, dynamic>;
|
try {
|
||||||
return IoniaMerchant.fromJsonMap(element);
|
final element = e as Map<String, dynamic>;
|
||||||
}).toList();
|
return IoniaMerchant.fromJsonMap(element);
|
||||||
|
} catch(_) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}).where((e) => e != null)
|
||||||
|
.toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get Merchants By Filter
|
// Get Merchants By Filter
|
||||||
|
@ -208,9 +213,14 @@ class IoniaApi {
|
||||||
|
|
||||||
final data = decodedBody['Data'] as List<dynamic>;
|
final data = decodedBody['Data'] as List<dynamic>;
|
||||||
return data.map((dynamic e) {
|
return data.map((dynamic e) {
|
||||||
final element = e['Merchant'] as Map<String, dynamic>;
|
try {
|
||||||
return IoniaMerchant.fromJsonMap(element);
|
final element = e['Merchant'] as Map<String, dynamic>;
|
||||||
}).toList();
|
return IoniaMerchant.fromJsonMap(element);
|
||||||
|
} catch(_) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}).where((e) => e != null)
|
||||||
|
.toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Purchase Gift Card
|
// Purchase Gift Card
|
||||||
|
@ -273,9 +283,14 @@ class IoniaApi {
|
||||||
|
|
||||||
final data = decodedBody['Data'] as List<dynamic>;
|
final data = decodedBody['Data'] as List<dynamic>;
|
||||||
return data.map((dynamic e) {
|
return data.map((dynamic e) {
|
||||||
final element = e as Map<String, dynamic>;
|
try {
|
||||||
return IoniaGiftCard.fromJsonMap(element);
|
final element = e as Map<String, dynamic>;
|
||||||
}).toList();
|
return IoniaGiftCard.fromJsonMap(element);
|
||||||
|
} catch(e) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}).where((e) => e != null)
|
||||||
|
.toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Charge Gift Card
|
// Charge Gift Card
|
||||||
|
|
|
@ -1,20 +1,7 @@
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
import 'package:cake_wallet/ionia/ionia_gift_card_instruction.dart';
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
|
|
||||||
class IoniaGiftCardInstruction {
|
|
||||||
IoniaGiftCardInstruction(this.header, this.body);
|
|
||||||
|
|
||||||
factory IoniaGiftCardInstruction.fromJsonMap(Map<String, dynamic> element) {
|
|
||||||
return IoniaGiftCardInstruction(
|
|
||||||
element['header'] as String,
|
|
||||||
element['body'] as String);
|
|
||||||
}
|
|
||||||
|
|
||||||
final String header;
|
|
||||||
final String body;
|
|
||||||
}
|
|
||||||
|
|
||||||
class IoniaGiftCard {
|
class IoniaGiftCard {
|
||||||
IoniaGiftCard({
|
IoniaGiftCard({
|
||||||
@required this.id,
|
@required this.id,
|
||||||
|
@ -24,10 +11,7 @@ class IoniaGiftCard {
|
||||||
@required this.barcodeUrl,
|
@required this.barcodeUrl,
|
||||||
@required this.cardNumber,
|
@required this.cardNumber,
|
||||||
@required this.cardPin,
|
@required this.cardPin,
|
||||||
@required this.usageInstructions,
|
@required this.instructions,
|
||||||
@required this.balanceInstructions,
|
|
||||||
@required this.paymentInstructions,
|
|
||||||
@required this.cardImageUrl,
|
|
||||||
@required this.tip,
|
@required this.tip,
|
||||||
@required this.purchaseAmount,
|
@required this.purchaseAmount,
|
||||||
@required this.actualAmount,
|
@required this.actualAmount,
|
||||||
|
@ -41,11 +25,6 @@ class IoniaGiftCard {
|
||||||
@required this.logoUrl});
|
@required this.logoUrl});
|
||||||
|
|
||||||
factory IoniaGiftCard.fromJsonMap(Map<String, dynamic> element) {
|
factory IoniaGiftCard.fromJsonMap(Map<String, dynamic> element) {
|
||||||
final decodedInstructions = json.decode(element['UsageInstructions'] as String) as Map<String, dynamic>;
|
|
||||||
final instruction = decodedInstructions['instruction'] as List<dynamic>;
|
|
||||||
final instructions = instruction
|
|
||||||
.map((dynamic e) =>IoniaGiftCardInstruction.fromJsonMap(e as Map<String, dynamic>))
|
|
||||||
.toList();
|
|
||||||
return IoniaGiftCard(
|
return IoniaGiftCard(
|
||||||
id: element['Id'] as int,
|
id: element['Id'] as int,
|
||||||
merchantId: element['MerchantId'] as int,
|
merchantId: element['MerchantId'] as int,
|
||||||
|
@ -65,7 +44,7 @@ class IoniaGiftCard {
|
||||||
logoUrl: element['LogoUrl'] as String,
|
logoUrl: element['LogoUrl'] as String,
|
||||||
createdDateFormatted: element['CreatedDate'] as String,
|
createdDateFormatted: element['CreatedDate'] as String,
|
||||||
lastTransactionDateFormatted: element['LastTransactionDate'] as String,
|
lastTransactionDateFormatted: element['LastTransactionDate'] as String,
|
||||||
usageInstructions: instructions);
|
instructions: IoniaGiftCardInstruction.parseListOfInstructions(element['PaymentInstructions'] as String));
|
||||||
}
|
}
|
||||||
|
|
||||||
final int id;
|
final int id;
|
||||||
|
@ -75,10 +54,7 @@ class IoniaGiftCard {
|
||||||
final String barcodeUrl;
|
final String barcodeUrl;
|
||||||
final String cardNumber;
|
final String cardNumber;
|
||||||
final String cardPin;
|
final String cardPin;
|
||||||
final List<IoniaGiftCardInstruction> usageInstructions;
|
final List<IoniaGiftCardInstruction> instructions;
|
||||||
final Map<String, dynamic> balanceInstructions;
|
|
||||||
final Map<String, dynamic> paymentInstructions;
|
|
||||||
final String cardImageUrl;
|
|
||||||
final double tip;
|
final double tip;
|
||||||
final double purchaseAmount;
|
final double purchaseAmount;
|
||||||
final double actualAmount;
|
final double actualAmount;
|
||||||
|
|
28
lib/ionia/ionia_gift_card_instruction.dart
Normal file
28
lib/ionia/ionia_gift_card_instruction.dart
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
import 'dart:convert';
|
||||||
|
import 'package:intl/intl.dart' show toBeginningOfSentenceCase;
|
||||||
|
|
||||||
|
class IoniaGiftCardInstruction {
|
||||||
|
IoniaGiftCardInstruction(this.header, this.body);
|
||||||
|
|
||||||
|
factory IoniaGiftCardInstruction.fromJsonMap(Map<String, dynamic> element) {
|
||||||
|
return IoniaGiftCardInstruction(
|
||||||
|
toBeginningOfSentenceCase(element['title'] as String ?? ''),
|
||||||
|
element['description'] as String);
|
||||||
|
}
|
||||||
|
|
||||||
|
static List<IoniaGiftCardInstruction> parseListOfInstructions(String instructionsJSON) {
|
||||||
|
List<IoniaGiftCardInstruction> instructions = <IoniaGiftCardInstruction>[];
|
||||||
|
|
||||||
|
if (instructionsJSON.isNotEmpty) {
|
||||||
|
final decodedInstructions = json.decode(instructionsJSON) as List<dynamic>;
|
||||||
|
instructions = decodedInstructions
|
||||||
|
.map((dynamic e) =>IoniaGiftCardInstruction.fromJsonMap(e as Map<String, dynamic>))
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
return instructions;
|
||||||
|
}
|
||||||
|
|
||||||
|
final String header;
|
||||||
|
final String body;
|
||||||
|
}
|
|
@ -1,4 +1,6 @@
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
|
import 'package:cake_wallet/ionia/ionia_gift_card_instruction.dart';
|
||||||
|
|
||||||
class IoniaMerchant {
|
class IoniaMerchant {
|
||||||
IoniaMerchant({
|
IoniaMerchant({
|
||||||
@required this.id,
|
@required this.id,
|
||||||
|
@ -48,7 +50,7 @@ class IoniaMerchant {
|
||||||
@required this.isVoidable,
|
@required this.isVoidable,
|
||||||
@required this.receiptMessage,
|
@required this.receiptMessage,
|
||||||
@required this.cssBorderCode,
|
@required this.cssBorderCode,
|
||||||
@required this.paymentInstructions,
|
@required this.instructions,
|
||||||
@required this.alderSku,
|
@required this.alderSku,
|
||||||
@required this.ngcSku,
|
@required this.ngcSku,
|
||||||
@required this.acceptedCurrency,
|
@required this.acceptedCurrency,
|
||||||
|
@ -59,103 +61,112 @@ class IoniaMerchant {
|
||||||
factory IoniaMerchant.fromJsonMap(Map<String, dynamic> element) {
|
factory IoniaMerchant.fromJsonMap(Map<String, dynamic> element) {
|
||||||
return IoniaMerchant(
|
return IoniaMerchant(
|
||||||
id: element["Id"] as int,
|
id: element["Id"] as int,
|
||||||
legalName: element["LegalName"] as String,
|
legalName: element["LegalName"] as String,
|
||||||
systemName: element["SystemName"] as String,
|
systemName: element["SystemName"] as String,
|
||||||
description: element["Description"] as String,
|
description: element["Description"] as String,
|
||||||
website: element["Website"] as String,
|
website: element["Website"] as String,
|
||||||
termsAndConditions: element["TermsAndConditions"] as String,
|
termsAndConditions: element["TermsAndConditions"] as String,
|
||||||
logoUrl: element["LogoUrl"] as String,
|
logoUrl: element["LogoUrl"] as String,
|
||||||
cardImageUrl: element["CardImageUrl"] as String,
|
cardImageUrl: element["CardImageUrl"] as String,
|
||||||
cardholderAgreement: element["CardholderAgreement"] as String,
|
cardholderAgreement: element["CardholderAgreement"] as String,
|
||||||
purchaseFee: element["PurchaseFee"] as double,
|
purchaseFee: element["PurchaseFee"] as double,
|
||||||
revenueShare: element["RevenueShare"] as double,
|
revenueShare: element["RevenueShare"] as double,
|
||||||
marketingFee: element["MarketingFee"] as double,
|
marketingFee: element["MarketingFee"] as double,
|
||||||
minimumDiscount: element["MinimumDiscount"] as double,
|
minimumDiscount: element["MinimumDiscount"] as double,
|
||||||
level1: element["Level1"] as double,
|
level1: element["Level1"] as double,
|
||||||
level2: element["Level2"] as double,
|
level2: element["Level2"] as double,
|
||||||
level3: element["Level3"] as double,
|
level3: element["Level3"] as double,
|
||||||
level4: element["Level4"] as double,
|
level4: element["Level4"] as double,
|
||||||
level5: element["Level5"] as double,
|
level5: element["Level5"] as double,
|
||||||
level6: element["Level6"] as double,
|
level6: element["Level6"] as double,
|
||||||
level7: element["Level7"] as double,
|
level7: element["Level7"] as double,
|
||||||
isActive: element["IsActive"] as bool,
|
isActive: element["IsActive"] as bool,
|
||||||
isDeleted: element["IsDeleted"] as bool,
|
isDeleted: element["IsDeleted"] as bool,
|
||||||
isOnline: element["IsOnline"] as bool,
|
isOnline: element["IsOnline"] as bool,
|
||||||
isPhysical: element["IsPhysical"] as bool,
|
isPhysical: element["IsPhysical"] as bool,
|
||||||
isVariablePurchase: element["IsVariablePurchase"] as bool,
|
isVariablePurchase: element["IsVariablePurchase"] as bool,
|
||||||
minimumCardPurchase: element["MinimumCardPurchase"] as double,
|
minimumCardPurchase: element["MinimumCardPurchase"] as double,
|
||||||
maximumCardPurchase: element["MaximumCardPurchase"] as double,
|
maximumCardPurchase: element["MaximumCardPurchase"] as double,
|
||||||
acceptsTips: element["AcceptsTips"] as bool,
|
acceptsTips: element["AcceptsTips"] as bool,
|
||||||
createdDateFormatted: element["CreatedDate"] as String,
|
createdDateFormatted: element["CreatedDate"] as String,
|
||||||
createdBy: element["CreatedBy"] as int,
|
createdBy: element["CreatedBy"] as int,
|
||||||
isRegional: element["IsRegional"] as bool,
|
isRegional: element["IsRegional"] as bool,
|
||||||
modifiedDateFormatted: element["ModifiedDate"] as String,
|
modifiedDateFormatted: element["ModifiedDate"] as String,
|
||||||
modifiedBy: element["ModifiedBy"] as int,
|
modifiedBy: element["ModifiedBy"] as int,
|
||||||
usageInstructions: element["UsageInstructions"] as String,
|
usageInstructions: element["UsageInstructions"] as String,
|
||||||
usageInstructionsBak: element["UsageInstructionsBak"] as String,
|
usageInstructionsBak: element["UsageInstructionsBak"] as String,
|
||||||
paymentGatewayId: element["PaymentGatewayId"] as int,
|
paymentGatewayId: element["PaymentGatewayId"] as int,
|
||||||
giftCardGatewayId: element["GiftCardGatewayId"] as int ,
|
giftCardGatewayId: element["GiftCardGatewayId"] as int ,
|
||||||
isHtmlDescription: element["IsHtmlDescription"] as bool,
|
isHtmlDescription: element["IsHtmlDescription"] as bool,
|
||||||
purchaseInstructions: element["PurchaseInstructions"] as String,
|
purchaseInstructions: element["PurchaseInstructions"] as String,
|
||||||
balanceInstructions: element["BalanceInstructions"] as String,
|
balanceInstructions: element["BalanceInstructions"] as String,
|
||||||
amountPerCard: element["AmountPerCard"] as double,
|
amountPerCard: element["AmountPerCard"] as double,
|
||||||
processingMessage: element["ProcessingMessage"] as String,
|
processingMessage: element["ProcessingMessage"] as String,
|
||||||
hasBarcode: element["HasBarcode"] as bool,
|
hasBarcode: element["HasBarcode"] as bool,
|
||||||
hasInventory: element["HasInventory"] as bool,
|
hasInventory: element["HasInventory"] as bool,
|
||||||
isVoidable: element["IsVoidable"] as bool,
|
isVoidable: element["IsVoidable"] as bool,
|
||||||
receiptMessage: element["ReceiptMessage"] as String,
|
receiptMessage: element["ReceiptMessage"] as String,
|
||||||
cssBorderCode: element["CssBorderCode"] as String,
|
cssBorderCode: element["CssBorderCode"] as String,
|
||||||
paymentInstructions: element["PaymentInstructions"] as String,
|
instructions: IoniaGiftCardInstruction.parseListOfInstructions(element['PaymentInstructions'] as String),
|
||||||
alderSku: element["AlderSku"] as String,
|
alderSku: element["AlderSku"] as String,
|
||||||
ngcSku: element["NgcSku"] as String,
|
ngcSku: element["NgcSku"] as String,
|
||||||
acceptedCurrency: element["AcceptedCurrency"] as String,
|
acceptedCurrency: element["AcceptedCurrency"] as String,
|
||||||
deepLink: element["DeepLink"] as String,
|
deepLink: element["DeepLink"] as String,
|
||||||
isPayLater: element["IsPayLater"] as bool);
|
isPayLater: element["IsPayLater"] as bool);
|
||||||
}
|
}
|
||||||
|
|
||||||
final int id; final String legalName; final String systemName; final String description; final String website; final String termsAndConditions; final String logoUrl; final String cardImageUrl; final String cardholderAgreement; final double purchaseFee;
|
final int id;
|
||||||
final double revenueShare;
|
final String legalName;
|
||||||
final double marketingFee;
|
final String systemName;
|
||||||
final double minimumDiscount;
|
final String description;
|
||||||
final double level1;
|
final String website;
|
||||||
final double level2;
|
final String termsAndConditions;
|
||||||
final double level3;
|
final String logoUrl;
|
||||||
final double level4;
|
final String cardImageUrl;
|
||||||
final double level5;
|
final String cardholderAgreement;
|
||||||
final double level6;
|
final double purchaseFee;
|
||||||
final double level7;
|
final double revenueShare;
|
||||||
final bool isActive;
|
final double marketingFee;
|
||||||
final bool isDeleted;
|
final double minimumDiscount;
|
||||||
final bool isOnline;
|
final double level1;
|
||||||
final bool isPhysical;
|
final double level2;
|
||||||
final bool isVariablePurchase;
|
final double level3;
|
||||||
final double minimumCardPurchase;
|
final double level4;
|
||||||
final double maximumCardPurchase;
|
final double level5;
|
||||||
final bool acceptsTips;
|
final double level6;
|
||||||
final String createdDateFormatted;
|
final double level7;
|
||||||
final int createdBy;
|
final bool isActive;
|
||||||
final bool isRegional;
|
final bool isDeleted;
|
||||||
final String modifiedDateFormatted;
|
final bool isOnline;
|
||||||
final int modifiedBy;
|
final bool isPhysical;
|
||||||
final String usageInstructions;
|
final bool isVariablePurchase;
|
||||||
final String usageInstructionsBak;
|
final double minimumCardPurchase;
|
||||||
final int paymentGatewayId;
|
final double maximumCardPurchase;
|
||||||
final int giftCardGatewayId;
|
final bool acceptsTips;
|
||||||
final bool isHtmlDescription;
|
final String createdDateFormatted;
|
||||||
final String purchaseInstructions;
|
final int createdBy;
|
||||||
final String balanceInstructions;
|
final bool isRegional;
|
||||||
final double amountPerCard;
|
final String modifiedDateFormatted;
|
||||||
final String processingMessage;
|
final int modifiedBy;
|
||||||
final bool hasBarcode;
|
final String usageInstructions;
|
||||||
final bool hasInventory;
|
final String usageInstructionsBak;
|
||||||
final bool isVoidable;
|
final int paymentGatewayId;
|
||||||
final String receiptMessage;
|
final int giftCardGatewayId;
|
||||||
final String cssBorderCode;
|
final bool isHtmlDescription;
|
||||||
final String paymentInstructions;
|
final String purchaseInstructions;
|
||||||
final String alderSku;
|
final String balanceInstructions;
|
||||||
final String ngcSku;
|
final double amountPerCard;
|
||||||
final String acceptedCurrency;
|
final String processingMessage;
|
||||||
final String deepLink;
|
final bool hasBarcode;
|
||||||
final bool isPayLater;
|
final bool hasInventory;
|
||||||
|
final bool isVoidable;
|
||||||
|
final String receiptMessage;
|
||||||
|
final String cssBorderCode;
|
||||||
|
final List<IoniaGiftCardInstruction> instructions;
|
||||||
|
final String alderSku;
|
||||||
|
final String ngcSku;
|
||||||
|
final String acceptedCurrency;
|
||||||
|
final String deepLink;
|
||||||
|
final bool isPayLater;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -258,15 +258,29 @@ class IoniaBuyGiftCardDetailPage extends BasePage {
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
return IoniaAlertModal(
|
return IoniaAlertModal(
|
||||||
title: S.of(context).how_to_use_card,
|
title: S.of(context).how_to_use_card,
|
||||||
content: Align(
|
content: Column(
|
||||||
alignment: Alignment.bottomLeft,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
child: Text(
|
children: merchant.instructions
|
||||||
merchant.usageInstructionsBak,
|
.map((instruction) {
|
||||||
style: textMedium(
|
return [
|
||||||
color: Theme.of(context).textTheme.display2.color,
|
Padding(
|
||||||
),
|
padding: EdgeInsets.all(10),
|
||||||
),
|
child: Text(
|
||||||
),
|
instruction.header,
|
||||||
|
style: textLargeSemiBold(
|
||||||
|
color: Theme.of(context).textTheme.display2.color,
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
Text(
|
||||||
|
instruction.body,
|
||||||
|
style: textMedium(
|
||||||
|
color: Theme.of(context).textTheme.display2.color,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
];
|
||||||
|
})
|
||||||
|
.expand((e) => e)
|
||||||
|
.toList()),
|
||||||
actionTitle: S.current.send_got_it,
|
actionTitle: S.current.send_got_it,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -159,7 +159,7 @@ class IoniaGiftCardDetailPage extends BasePage {
|
||||||
title: S.of(context).how_to_use_card,
|
title: S.of(context).how_to_use_card,
|
||||||
content: Column(
|
content: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: viewModel.giftCard.usageInstructions
|
children: viewModel.giftCard.instructions
|
||||||
.map((instruction) {
|
.map((instruction) {
|
||||||
return [
|
return [
|
||||||
Padding(
|
Padding(
|
||||||
|
|
|
@ -1,12 +1,10 @@
|
||||||
import 'package:cake_wallet/ionia/ionia_gift_card.dart';
|
import 'package:cake_wallet/ionia/ionia_gift_card.dart';
|
||||||
import 'package:cake_wallet/routes.dart';
|
import 'package:cake_wallet/routes.dart';
|
||||||
import 'package:cake_wallet/src/screens/base_page.dart';
|
import 'package:cake_wallet/src/screens/base_page.dart';
|
||||||
import 'package:cake_wallet/src/widgets/alert_with_one_action.dart';
|
|
||||||
import 'package:cake_wallet/src/widgets/primary_button.dart';
|
import 'package:cake_wallet/src/widgets/primary_button.dart';
|
||||||
import 'package:cake_wallet/src/widgets/scollable_with_bottom_section.dart';
|
import 'package:cake_wallet/src/widgets/scollable_with_bottom_section.dart';
|
||||||
import 'package:cake_wallet/typography.dart';
|
import 'package:cake_wallet/typography.dart';
|
||||||
import 'package:cake_wallet/utils/show_bar.dart';
|
import 'package:cake_wallet/utils/show_bar.dart';
|
||||||
import 'package:cake_wallet/utils/show_pop_up.dart';
|
|
||||||
import 'package:cake_wallet/view_model/ionia/ionia_payment_status_view_model.dart';
|
import 'package:cake_wallet/view_model/ionia/ionia_payment_status_view_model.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:cake_wallet/generated/i18n.dart';
|
import 'package:cake_wallet/generated/i18n.dart';
|
||||||
|
@ -44,7 +42,6 @@ class _IoniaPaymentStatusPageBody extends StatefulWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
class _IoniaPaymentStatusPageBodyBodyState extends State<_IoniaPaymentStatusPageBody> {
|
class _IoniaPaymentStatusPageBodyBodyState extends State<_IoniaPaymentStatusPageBody> {
|
||||||
ReactionDisposer _onErrorReaction;
|
|
||||||
ReactionDisposer _onGiftCardReaction;
|
ReactionDisposer _onGiftCardReaction;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -55,34 +52,6 @@ class _IoniaPaymentStatusPageBodyBodyState extends State<_IoniaPaymentStatusPage
|
||||||
.pushReplacementNamed(Routes.ioniaGiftCardDetailPage, arguments: [widget.viewModel.giftCard]);
|
.pushReplacementNamed(Routes.ioniaGiftCardDetailPage, arguments: [widget.viewModel.giftCard]);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (widget.viewModel.error != null) {
|
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
|
||||||
showPopUp<void>(
|
|
||||||
context: context,
|
|
||||||
builder: (BuildContext context) {
|
|
||||||
return AlertWithOneAction(
|
|
||||||
alertTitle: S.of(context).error,
|
|
||||||
alertContent: widget.viewModel.error,
|
|
||||||
buttonText: S.of(context).ok,
|
|
||||||
buttonAction: () => Navigator.of(context).pop());
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
_onErrorReaction = reaction((_) => widget.viewModel.error, (String error) {
|
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
|
||||||
showPopUp<void>(
|
|
||||||
context: context,
|
|
||||||
builder: (BuildContext context) {
|
|
||||||
return AlertWithOneAction(
|
|
||||||
alertTitle: S.of(context).error,
|
|
||||||
alertContent: error,
|
|
||||||
buttonText: S.of(context).ok,
|
|
||||||
buttonAction: () => Navigator.of(context).pop());
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
_onGiftCardReaction = reaction((_) => widget.viewModel.giftCard, (IoniaGiftCard giftCard) {
|
_onGiftCardReaction = reaction((_) => widget.viewModel.giftCard, (IoniaGiftCard giftCard) {
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
|
@ -96,7 +65,6 @@ class _IoniaPaymentStatusPageBodyBodyState extends State<_IoniaPaymentStatusPage
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
_onErrorReaction?.reaction?.dispose();
|
|
||||||
_onGiftCardReaction?.reaction?.dispose();
|
_onGiftCardReaction?.reaction?.dispose();
|
||||||
widget.viewModel.timer.cancel();
|
widget.viewModel.timer.cancel();
|
||||||
super.dispose();
|
super.dispose();
|
||||||
|
|
Loading…
Reference in a new issue