mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-01-11 21:34:48 +00:00
checkout screen fixes for ionia
This commit is contained in:
parent
622914fd61
commit
48dc741cee
5 changed files with 107 additions and 83 deletions
|
@ -3,10 +3,4 @@ class IoniaTip {
|
||||||
final double originalAmount;
|
final double originalAmount;
|
||||||
final double percentage;
|
final double percentage;
|
||||||
double get additionalAmount => double.parse((originalAmount * percentage / 100).toStringAsFixed(2));
|
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)
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,8 +7,8 @@ import 'package:cake_wallet/ionia/ionia_tip.dart';
|
||||||
import 'package:cake_wallet/palette.dart';
|
import 'package:cake_wallet/palette.dart';
|
||||||
import 'package:cake_wallet/routes.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/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/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/alert_with_one_action.dart';
|
||||||
import 'package:cake_wallet/src/widgets/discount_badge.dart';
|
import 'package:cake_wallet/src/widgets/discount_badge.dart';
|
||||||
import 'package:cake_wallet/src/widgets/primary_button.dart';
|
import 'package:cake_wallet/src/widgets/primary_button.dart';
|
||||||
|
@ -110,11 +110,8 @@ class IoniaBuyGiftCardDetailPage extends StatelessWidget {
|
||||||
|
|
||||||
if (state is ExecutedSuccessfullyState) {
|
if (state is ExecutedSuccessfullyState) {
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
Navigator.of(context).pushReplacementNamed(
|
Navigator.of(context).pushReplacementNamed(Routes.ioniaPaymentStatusPage,
|
||||||
Routes.ioniaPaymentStatusPage,
|
arguments: [ioniaPurchaseViewModel.paymentInfo, ioniaPurchaseViewModel.committedInfo]);
|
||||||
arguments: [
|
|
||||||
ioniaPurchaseViewModel.paymentInfo,
|
|
||||||
ioniaPurchaseViewModel.committedInfo]);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -161,7 +158,7 @@ class IoniaBuyGiftCardDetailPage extends StatelessWidget {
|
||||||
),
|
),
|
||||||
SizedBox(height: 4),
|
SizedBox(height: 4),
|
||||||
Text(
|
Text(
|
||||||
'\$${ioniaPurchaseViewModel.giftCardAmount}',
|
'\$${ioniaPurchaseViewModel.giftCardAmount.toStringAsFixed(2)}',
|
||||||
style: textXLargeSemiBold(),
|
style: textXLargeSemiBold(),
|
||||||
),
|
),
|
||||||
SizedBox(height: 24),
|
SizedBox(height: 24),
|
||||||
|
@ -179,7 +176,7 @@ class IoniaBuyGiftCardDetailPage extends StatelessWidget {
|
||||||
),
|
),
|
||||||
SizedBox(height: 4),
|
SizedBox(height: 4),
|
||||||
Text(
|
Text(
|
||||||
'\$${ioniaPurchaseViewModel.amount}',
|
'\$${ioniaPurchaseViewModel.amount.toStringAsFixed(2)}',
|
||||||
style: textLargeSemiBold(),
|
style: textLargeSemiBold(),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
@ -193,7 +190,7 @@ class IoniaBuyGiftCardDetailPage extends StatelessWidget {
|
||||||
),
|
),
|
||||||
SizedBox(height: 4),
|
SizedBox(height: 4),
|
||||||
Text(
|
Text(
|
||||||
'\$$tipAmount',
|
'\$${tipAmount.toStringAsFixed(2)}',
|
||||||
style: textLargeSemiBold(),
|
style: textLargeSemiBold(),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
@ -273,11 +270,10 @@ class IoniaBuyGiftCardDetailPage extends StatelessWidget {
|
||||||
showPopUp<void>(
|
showPopUp<void>(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
return AlertWithOneAction(
|
return IoniaAlertModal(
|
||||||
alertTitle: '',
|
title: '',
|
||||||
alertContent: ioniaPurchaseViewModel.ioniaMerchant.termsAndConditions,
|
content: ioniaPurchaseViewModel.ioniaMerchant.termsAndConditions,
|
||||||
buttonText: S.of(context).agree,
|
actionTitle: S.of(context).agree,
|
||||||
buttonAction: () => Navigator.of(context).pop(),
|
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
@ -298,65 +294,10 @@ class IoniaBuyGiftCardDetailPage extends StatelessWidget {
|
||||||
showPopUp<void>(
|
showPopUp<void>(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
return AlertBackground(
|
return IoniaAlertModal(
|
||||||
child: Material(
|
title: S.of(context).how_to_use_card,
|
||||||
color: Colors.transparent,
|
content: merchant.usageInstructionsBak,
|
||||||
child: Column(
|
actionTitle: S.current.send_got_it,
|
||||||
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,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,7 +87,8 @@ class IoniaBuyGiftCardPage extends BasePage {
|
||||||
keyboardType: TextInputType.numberWithOptions(signed: false, decimal: true),
|
keyboardType: TextInputType.numberWithOptions(signed: false, decimal: true),
|
||||||
inputFormatters: [
|
inputFormatters: [
|
||||||
FilteringTextInputFormatter.deny(RegExp('[\-|\ ]')),
|
FilteringTextInputFormatter.deny(RegExp('[\-|\ ]')),
|
||||||
WhitelistingTextInputFormatter(RegExp(r'^\d+(\.|\,)?\d{0,2}'))],
|
WhitelistingTextInputFormatter(RegExp(r'^\d+(\.|\,)?\d{0,2}'))
|
||||||
|
],
|
||||||
hintText: '1000',
|
hintText: '1000',
|
||||||
placeholderTextStyle: TextStyle(
|
placeholderTextStyle: TextStyle(
|
||||||
color: Theme.of(context).primaryTextTheme.headline.color,
|
color: Theme.of(context).primaryTextTheme.headline.color,
|
||||||
|
@ -124,13 +125,13 @@ class IoniaBuyGiftCardPage extends BasePage {
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
S.of(context).min_amount(merchant.minimumCardPurchase.toString()),
|
S.of(context).min_amount(merchant.minimumCardPurchase.toStringAsFixed(2)),
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Theme.of(context).primaryTextTheme.headline.color,
|
color: Theme.of(context).primaryTextTheme.headline.color,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
S.of(context).max_amount(merchant.maximumCardPurchase.toString()),
|
S.of(context).max_amount(merchant.maximumCardPurchase.toStringAsFixed(2)),
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Theme.of(context).primaryTextTheme.headline.color,
|
color: Theme.of(context).primaryTextTheme.headline.color,
|
||||||
),
|
),
|
||||||
|
|
87
lib/src/screens/ionia/widgets/ionia_alert_modal.dart
Normal file
87
lib/src/screens/ionia/widgets/ionia_alert_modal.dart
Normal 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,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
|
@ -22,7 +22,8 @@ abstract class IoniaMerchPurchaseViewModelBase with Store {
|
||||||
percentage = 0.0;
|
percentage = 0.0;
|
||||||
tips = <IoniaTip>[
|
tips = <IoniaTip>[
|
||||||
IoniaTip(percentage: 0, originalAmount: amount),
|
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),
|
IoniaTip(percentage: 20, originalAmount: amount),
|
||||||
];
|
];
|
||||||
selectedTip = tips.first;
|
selectedTip = tips.first;
|
||||||
|
|
Loading…
Reference in a new issue