checkout screen fixes for ionia

This commit is contained in:
Godwin Asuquo 2022-07-20 18:56:52 +03:00
parent 622914fd61
commit 48dc741cee
5 changed files with 107 additions and 83 deletions

View file

@ -3,10 +3,4 @@ class IoniaTip {
final double originalAmount;
final double percentage;
double get additionalAmount => double.parse((originalAmount * percentage / 100).toStringAsFixed(2));
static const tipList = [
IoniaTip(originalAmount: 0, percentage: 0),
IoniaTip(originalAmount: 10, percentage: 10),
IoniaTip(originalAmount: 20, percentage: 20)
];
}

View file

@ -7,8 +7,8 @@ import 'package:cake_wallet/ionia/ionia_tip.dart';
import 'package:cake_wallet/palette.dart';
import 'package:cake_wallet/routes.dart';
import 'package:cake_wallet/src/screens/ionia/widgets/confirm_modal.dart';
import 'package:cake_wallet/src/screens/ionia/widgets/ionia_alert_modal.dart';
import 'package:cake_wallet/src/screens/ionia/widgets/text_icon_button.dart';
import 'package:cake_wallet/src/widgets/alert_background.dart';
import 'package:cake_wallet/src/widgets/alert_with_one_action.dart';
import 'package:cake_wallet/src/widgets/discount_badge.dart';
import 'package:cake_wallet/src/widgets/primary_button.dart';
@ -110,11 +110,8 @@ class IoniaBuyGiftCardDetailPage extends StatelessWidget {
if (state is ExecutedSuccessfullyState) {
WidgetsBinding.instance.addPostFrameCallback((_) {
Navigator.of(context).pushReplacementNamed(
Routes.ioniaPaymentStatusPage,
arguments: [
ioniaPurchaseViewModel.paymentInfo,
ioniaPurchaseViewModel.committedInfo]);
Navigator.of(context).pushReplacementNamed(Routes.ioniaPaymentStatusPage,
arguments: [ioniaPurchaseViewModel.paymentInfo, ioniaPurchaseViewModel.committedInfo]);
});
}
});
@ -161,7 +158,7 @@ class IoniaBuyGiftCardDetailPage extends StatelessWidget {
),
SizedBox(height: 4),
Text(
'\$${ioniaPurchaseViewModel.giftCardAmount}',
'\$${ioniaPurchaseViewModel.giftCardAmount.toStringAsFixed(2)}',
style: textXLargeSemiBold(),
),
SizedBox(height: 24),
@ -179,7 +176,7 @@ class IoniaBuyGiftCardDetailPage extends StatelessWidget {
),
SizedBox(height: 4),
Text(
'\$${ioniaPurchaseViewModel.amount}',
'\$${ioniaPurchaseViewModel.amount.toStringAsFixed(2)}',
style: textLargeSemiBold(),
),
],
@ -193,7 +190,7 @@ class IoniaBuyGiftCardDetailPage extends StatelessWidget {
),
SizedBox(height: 4),
Text(
'\$$tipAmount',
'\$${tipAmount.toStringAsFixed(2)}',
style: textLargeSemiBold(),
),
],
@ -273,11 +270,10 @@ class IoniaBuyGiftCardDetailPage extends StatelessWidget {
showPopUp<void>(
context: context,
builder: (BuildContext context) {
return AlertWithOneAction(
alertTitle: '',
alertContent: ioniaPurchaseViewModel.ioniaMerchant.termsAndConditions,
buttonText: S.of(context).agree,
buttonAction: () => Navigator.of(context).pop(),
return IoniaAlertModal(
title: '',
content: ioniaPurchaseViewModel.ioniaMerchant.termsAndConditions,
actionTitle: S.of(context).agree,
);
},
);
@ -298,65 +294,10 @@ class IoniaBuyGiftCardDetailPage extends StatelessWidget {
showPopUp<void>(
context: context,
builder: (BuildContext context) {
return AlertBackground(
child: Material(
color: Colors.transparent,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
SizedBox(height: 10),
Container(
padding: EdgeInsets.only(top: 24, left: 24, right: 24),
margin: EdgeInsets.all(24),
decoration: BoxDecoration(
color: Theme.of(context).backgroundColor,
borderRadius: BorderRadius.circular(30),
),
child: Column(
children: [
Text(
S.of(context).how_to_use_card,
style: textLargeSemiBold(
color: Theme.of(context).textTheme.body1.color,
),
),
SizedBox(height: 24),
Align(
alignment: Alignment.bottomLeft,
child: Text(
merchant.usageInstructionsBak,
style: textMedium(
color: Theme.of(context).textTheme.display2.color,
),
),
),
SizedBox(height: 35),
PrimaryButton(
onPressed: () => Navigator.pop(context),
text: S.of(context).send_got_it,
color: Color.fromRGBO(233, 242, 252, 1),
textColor: Theme.of(context).textTheme.display2.color,
),
SizedBox(height: 21),
],
),
),
InkWell(
onTap: () => Navigator.pop(context),
child: Container(
margin: EdgeInsets.only(bottom: 40),
child: CircleAvatar(
child: Icon(
Icons.close,
color: Colors.black,
),
backgroundColor: Colors.white,
),
),
)
],
),
),
return IoniaAlertModal(
title: S.of(context).how_to_use_card,
content: merchant.usageInstructionsBak,
actionTitle: S.current.send_got_it,
);
});
}

View file

@ -87,7 +87,8 @@ class IoniaBuyGiftCardPage extends BasePage {
keyboardType: TextInputType.numberWithOptions(signed: false, decimal: true),
inputFormatters: [
FilteringTextInputFormatter.deny(RegExp('[\-|\ ]')),
WhitelistingTextInputFormatter(RegExp(r'^\d+(\.|\,)?\d{0,2}'))],
WhitelistingTextInputFormatter(RegExp(r'^\d+(\.|\,)?\d{0,2}'))
],
hintText: '1000',
placeholderTextStyle: TextStyle(
color: Theme.of(context).primaryTextTheme.headline.color,
@ -124,13 +125,13 @@ class IoniaBuyGiftCardPage extends BasePage {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
S.of(context).min_amount(merchant.minimumCardPurchase.toString()),
S.of(context).min_amount(merchant.minimumCardPurchase.toStringAsFixed(2)),
style: TextStyle(
color: Theme.of(context).primaryTextTheme.headline.color,
),
),
Text(
S.of(context).max_amount(merchant.maximumCardPurchase.toString()),
S.of(context).max_amount(merchant.maximumCardPurchase.toStringAsFixed(2)),
style: TextStyle(
color: Theme.of(context).primaryTextTheme.headline.color,
),

View file

@ -0,0 +1,87 @@
import 'package:cake_wallet/src/widgets/alert_background.dart';
import 'package:cake_wallet/src/widgets/primary_button.dart';
import 'package:cake_wallet/typography.dart';
import 'package:flutter/material.dart';
class IoniaAlertModal extends StatelessWidget {
const IoniaAlertModal({
Key key,
@required this.title,
@required this.content,
@required this.actionTitle,
}) : super(key: key);
final String title;
final String content;
final String actionTitle;
@override
Widget build(BuildContext context) {
return AlertBackground(
child: Material(
color: Colors.transparent,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
SizedBox(height: 10),
Container(
padding: EdgeInsets.only(top: 24, left: 24, right: 24),
margin: EdgeInsets.all(24),
decoration: BoxDecoration(
color: Theme.of(context).backgroundColor,
borderRadius: BorderRadius.circular(30),
),
child: Column(
children: [
if (title.isNotEmpty)
Text(
title,
style: textLargeSemiBold(
color: Theme.of(context).textTheme.body1.color,
),
),
Container(
constraints: BoxConstraints(maxHeight: MediaQuery.of(context).size.height * 0.4),
child: ListView(
children: [
Align(
alignment: Alignment.bottomLeft,
child: Text(
content,
style: textMedium(
color: Theme.of(context).textTheme.display2.color,
),
),
),
SizedBox(height: 35),
],
),
),
PrimaryButton(
onPressed: () => Navigator.pop(context),
text: actionTitle,
color: Color.fromRGBO(233, 242, 252, 1),
textColor: Theme.of(context).textTheme.display2.color,
),
SizedBox(height: 21),
],
),
),
InkWell(
onTap: () => Navigator.pop(context),
child: Container(
margin: EdgeInsets.only(bottom: 40),
child: CircleAvatar(
child: Icon(
Icons.close,
color: Colors.black,
),
backgroundColor: Colors.white,
),
),
)
],
),
),
);
}
}

View file

@ -22,7 +22,8 @@ abstract class IoniaMerchPurchaseViewModelBase with Store {
percentage = 0.0;
tips = <IoniaTip>[
IoniaTip(percentage: 0, originalAmount: amount),
IoniaTip(percentage: 10, originalAmount: amount),
IoniaTip(percentage: 15, originalAmount: amount),
IoniaTip(percentage: 18, originalAmount: amount),
IoniaTip(percentage: 20, originalAmount: amount),
];
selectedTip = tips.first;