mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-03-06 08:44:35 +00:00
fix uses from PR
This commit is contained in:
parent
16616cf7d8
commit
d7b69b81c3
9 changed files with 141 additions and 117 deletions
lib
src/screens
dashboard/widgets
ionia
view_model/ionia
res/values
|
@ -4,7 +4,8 @@ import 'package:flutter/material.dart';
|
|||
import 'package:cake_wallet/generated/i18n.dart';
|
||||
|
||||
class MarketPlacePage extends StatelessWidget {
|
||||
final ScrollController _scrollController = ScrollController();
|
||||
final _scrollController = ScrollController();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
|
|
|
@ -57,7 +57,7 @@ class IoniaCreateAccountPage extends BasePage {
|
|||
content: Form(
|
||||
key: _formKey,
|
||||
child: BaseTextFormField(
|
||||
hintText: 'Email Address',
|
||||
hintText: S.of(context).email_address,
|
||||
focusNode: _emailFocus,
|
||||
validator: EmailValidator(),
|
||||
controller: _emailController,
|
||||
|
@ -89,7 +89,7 @@ class IoniaCreateAccountPage extends BasePage {
|
|||
RichText(
|
||||
textAlign: TextAlign.center,
|
||||
text: TextSpan(
|
||||
text: 'By creating account you agree to the ',
|
||||
text: S.of(context).agree_to,
|
||||
style: TextStyle(
|
||||
color: Color(0xff7A93BA),
|
||||
fontSize: 12,
|
||||
|
@ -103,7 +103,7 @@ class IoniaCreateAccountPage extends BasePage {
|
|||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
TextSpan(text: ' and '),
|
||||
TextSpan(text: ' ${S.of(context).and} '),
|
||||
TextSpan(
|
||||
text: S.of(context).privacy_policy,
|
||||
style: TextStyle(
|
||||
|
@ -121,22 +121,22 @@ class IoniaCreateAccountPage extends BasePage {
|
|||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
void _onCreateUserFailure(BuildContext context, String error) {
|
||||
showPopUp<void>(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertWithOneAction(
|
||||
alertTitle: S.current.create_account,
|
||||
alertContent: error,
|
||||
buttonText: S.of(context).ok,
|
||||
buttonAction: () => Navigator.of(context).pop());
|
||||
});
|
||||
}
|
||||
void _onCreateUserFailure(BuildContext context, String error) {
|
||||
showPopUp<void>(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertWithOneAction(
|
||||
alertTitle: S.current.create_account,
|
||||
alertContent: error,
|
||||
buttonText: S.of(context).ok,
|
||||
buttonAction: () => Navigator.of(context).pop());
|
||||
});
|
||||
}
|
||||
|
||||
void _onCreateSuccessful(BuildContext context, IoniaViewModel ioniaViewModel) => Navigator.pushNamed(
|
||||
context,
|
||||
Routes.ioniaVerifyIoniaOtpPage,
|
||||
arguments: [ioniaViewModel.email, ioniaViewModel],
|
||||
);
|
||||
void _onCreateSuccessful(BuildContext context, IoniaViewModel ioniaViewModel) => Navigator.pushNamed(
|
||||
context,
|
||||
Routes.ioniaVerifyIoniaOtpPage,
|
||||
arguments: [ioniaViewModel.email, ioniaViewModel],
|
||||
);
|
||||
}
|
||||
|
|
|
@ -58,7 +58,7 @@ class IoniaLoginPage extends BasePage {
|
|||
content: Form(
|
||||
key: _formKey,
|
||||
child: BaseTextFormField(
|
||||
hintText: 'Email Address',
|
||||
hintText: S.of(context).email_address,
|
||||
validator: EmailValidator(),
|
||||
controller: _emailController,
|
||||
),
|
||||
|
@ -92,22 +92,22 @@ class IoniaLoginPage extends BasePage {
|
|||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
void _onLoginUserFailure(BuildContext context, String error) {
|
||||
showPopUp<void>(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertWithOneAction(
|
||||
alertTitle: S.current.login,
|
||||
alertContent: error,
|
||||
buttonText: S.of(context).ok,
|
||||
buttonAction: () => Navigator.of(context).pop());
|
||||
});
|
||||
}
|
||||
void _onLoginUserFailure(BuildContext context, String error) {
|
||||
showPopUp<void>(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertWithOneAction(
|
||||
alertTitle: S.current.login,
|
||||
alertContent: error,
|
||||
buttonText: S.of(context).ok,
|
||||
buttonAction: () => Navigator.of(context).pop());
|
||||
});
|
||||
}
|
||||
|
||||
void _onLoginSuccessful(BuildContext context, IoniaViewModel ioniaViewModel) => Navigator.pushNamed(
|
||||
context,
|
||||
Routes.ioniaVerifyIoniaOtpPage,
|
||||
arguments: [ioniaViewModel.email, ioniaViewModel],
|
||||
);
|
||||
void _onLoginSuccessful(BuildContext context, IoniaViewModel ioniaViewModel) => Navigator.pushNamed(
|
||||
context,
|
||||
Routes.ioniaVerifyIoniaOtpPage,
|
||||
arguments: [ioniaViewModel.email, ioniaViewModel],
|
||||
);
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@ class IoniaVerifyIoniaOtp extends BasePage {
|
|||
content: Column(
|
||||
children: [
|
||||
BaseTextFormField(
|
||||
hintText: 'Enter code',
|
||||
hintText: S.of(context).enter_code,
|
||||
focusNode: _codeFocus,
|
||||
controller: _codeController,
|
||||
),
|
||||
|
@ -111,19 +111,19 @@ class IoniaVerifyIoniaOtp extends BasePage {
|
|||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
void _onOtpFailure(BuildContext context, String error) {
|
||||
showPopUp<void>(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertWithOneAction(
|
||||
alertTitle: S.current.verification,
|
||||
alertContent: error,
|
||||
buttonText: S.of(context).ok,
|
||||
buttonAction: () => Navigator.of(context).pop());
|
||||
});
|
||||
}
|
||||
void _onOtpFailure(BuildContext context, String error) {
|
||||
showPopUp<void>(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertWithOneAction(
|
||||
alertTitle: S.current.verification,
|
||||
alertContent: error,
|
||||
buttonText: S.of(context).ok,
|
||||
buttonAction: () => Navigator.of(context).pop());
|
||||
});
|
||||
}
|
||||
|
||||
void _onOtpSuccessful(BuildContext context) =>
|
||||
Navigator.pushNamedAndRemoveUntil(context, Routes.ioniaManageCardsPage, ModalRoute.withName(Routes.dashboard));
|
||||
void _onOtpSuccessful(BuildContext context) =>
|
||||
Navigator.pushNamedAndRemoveUntil(context, Routes.ioniaManageCardsPage, ModalRoute.withName(Routes.dashboard));
|
||||
}
|
||||
|
|
|
@ -81,34 +81,34 @@ class IoniaActivateDebitCardPage extends BasePage {
|
|||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
void _onCreateCardFailure(BuildContext context, String errorMessage) {
|
||||
showPopUp<void>(
|
||||
void _onCreateCardFailure(BuildContext context, String errorMessage) {
|
||||
showPopUp<void>(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertWithOneAction(
|
||||
alertTitle: S.current.error,
|
||||
alertContent: errorMessage,
|
||||
buttonText: S.of(context).ok,
|
||||
buttonAction: () => Navigator.of(context).pop());
|
||||
});
|
||||
}
|
||||
|
||||
void _onCreateCardSuccess(BuildContext context) {
|
||||
Navigator.pushNamed(
|
||||
context,
|
||||
Routes.ioniaDebitCardPage,
|
||||
);
|
||||
showPopUp<void>(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertWithOneAction(
|
||||
alertTitle: S.current.error,
|
||||
alertContent: errorMessage,
|
||||
buttonText: S.of(context).ok,
|
||||
buttonAction: () => Navigator.of(context).pop());
|
||||
});
|
||||
}
|
||||
|
||||
void _onCreateCardSuccess(BuildContext context) {
|
||||
Navigator.pushNamed(
|
||||
context,
|
||||
Routes.ioniaDebitCardPage,
|
||||
);
|
||||
showPopUp<void>(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertWithOneAction(
|
||||
alertTitle: 'Congratulations!',
|
||||
alertContent: 'You now have a debit card',
|
||||
buttonText: S.of(context).ok,
|
||||
buttonAction: () => Navigator.of(context).pop(),
|
||||
);
|
||||
},
|
||||
);
|
||||
alertTitle: S.of(context).congratulations,
|
||||
alertContent: S.of(context).you_now_have_debit_card,
|
||||
buttonText: S.of(context).ok,
|
||||
buttonAction: () => Navigator.of(context).pop(),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ class IoniaBuyGiftCardPage extends BasePage {
|
|||
: _amountFieldFocus = FocusNode(),
|
||||
_amountController = TextEditingController();
|
||||
@override
|
||||
String get title => 'Enter Amount';
|
||||
String get title => S.current.enter_amount;
|
||||
|
||||
@override
|
||||
Color get titleColor => Colors.white;
|
||||
|
@ -107,13 +107,13 @@ class IoniaBuyGiftCardPage extends BasePage {
|
|||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
'Min: \$5',
|
||||
S.of(context).min_amount('5'),
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).primaryTextTheme.headline.color,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'Max: \$20000',
|
||||
S.of(context).max_amount('20000'),
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).primaryTextTheme.headline.color,
|
||||
),
|
||||
|
|
|
@ -56,21 +56,21 @@ class IoniaDebitCardPage extends BasePage {
|
|||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20.0),
|
||||
child: Text(
|
||||
'If asked for a billing address, provide your shipping address',
|
||||
S.of(context).billing_address_info,
|
||||
style: textSmall(color: Theme.of(context).textTheme.display1.color),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 24),
|
||||
PrimaryButton(
|
||||
text: 'Order Physical Card',
|
||||
text: S.of(context).order_physical_card,
|
||||
onPressed: () {},
|
||||
color: Color(0xffE9F2FC),
|
||||
textColor: Theme.of(context).textTheme.display2.color,
|
||||
),
|
||||
SizedBox(height: 8),
|
||||
PrimaryButton(
|
||||
text: 'Add Value',
|
||||
text: S.of(context).add_value,
|
||||
onPressed: () {},
|
||||
color: Theme.of(context).accentTextTheme.body2.color,
|
||||
textColor: Colors.white,
|
||||
|
@ -117,16 +117,18 @@ class IoniaDebitCardPage extends BasePage {
|
|||
),
|
||||
child: RichText(
|
||||
text: TextSpan(
|
||||
text: 'Get a',
|
||||
style: textMedium(color: Theme.of(context).textTheme.display2.color),
|
||||
children: [
|
||||
TextSpan(
|
||||
text: ' digital and physical prepaid debit card',
|
||||
style: textMediumBold(color: Theme.of(context).textTheme.display2.color),
|
||||
),
|
||||
TextSpan(
|
||||
text: ' that you can reload with digital currencies. No additional information needed!')
|
||||
])),
|
||||
text: S.of(context).get_a,
|
||||
style: textMedium(color: Theme.of(context).textTheme.display2.color),
|
||||
children: [
|
||||
TextSpan(
|
||||
text: S.of(context).digital_and_physical_card,
|
||||
style: textMediumBold(color: Theme.of(context).textTheme.display2.color),
|
||||
),
|
||||
TextSpan(
|
||||
text: S.of(context).get_card_note,
|
||||
)
|
||||
],
|
||||
)),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
@ -136,7 +138,7 @@ class IoniaDebitCardPage extends BasePage {
|
|||
vertical: 32,
|
||||
),
|
||||
bottomSection: PrimaryButton(
|
||||
text: 'Activate',
|
||||
text: S.of(context).activate,
|
||||
onPressed: () => _showHowToUseCard(context, activate: true),
|
||||
color: Theme.of(context).accentTextTheme.body2.color,
|
||||
textColor: Colors.white,
|
||||
|
@ -167,7 +169,7 @@ class IoniaDebitCardPage extends BasePage {
|
|||
child: Column(
|
||||
children: [
|
||||
Text(
|
||||
'How to use this card',
|
||||
S.of(context).how_to_use_card,
|
||||
style: textLargeSemiBold(
|
||||
color: Theme.of(context).textTheme.body1.color,
|
||||
),
|
||||
|
@ -176,7 +178,7 @@ class IoniaDebitCardPage extends BasePage {
|
|||
Align(
|
||||
alignment: Alignment.bottomLeft,
|
||||
child: Text(
|
||||
'Sign up for the card and accept the terms.',
|
||||
S.of(context).signup_for_card_accept_terms,
|
||||
style: textSmallSemiBold(
|
||||
color: Theme.of(context).textTheme.display2.color,
|
||||
),
|
||||
|
@ -184,21 +186,20 @@ class IoniaDebitCardPage extends BasePage {
|
|||
),
|
||||
SizedBox(height: 24),
|
||||
_TitleSubtitleTile(
|
||||
title: 'Add prepaid funds to the cards (up to \$1000)',
|
||||
subtitle:
|
||||
'Funds are converted to USD when the held in the prepaid account, not in digital currencies.',
|
||||
title: S.of(context).add_fund_to_card('1000'),
|
||||
subtitle: S.of(context).use_card_info_two,
|
||||
),
|
||||
SizedBox(height: 21),
|
||||
_TitleSubtitleTile(
|
||||
title: 'Use the digital card online or with contactless payment methods.',
|
||||
subtitle: 'Optionally order a physical card.',
|
||||
title: S.of(context).use_card_info_three,
|
||||
subtitle: S.of(context).optionally_order_card,
|
||||
),
|
||||
SizedBox(height: 35),
|
||||
PrimaryButton(
|
||||
onPressed: () => activate
|
||||
? Navigator.pushNamed(context, Routes.ioniaActivateDebitCardPage)
|
||||
: Navigator.pop(context),
|
||||
text: 'Got it!',
|
||||
text: S.of(context).send_got_it,
|
||||
color: Color.fromRGBO(233, 242, 252, 1),
|
||||
textColor: Theme.of(context).textTheme.display2.color,
|
||||
),
|
||||
|
@ -287,7 +288,7 @@ class _IoniaDebitCardState extends State<_IoniaDebitCard> {
|
|||
],
|
||||
),
|
||||
Text(
|
||||
widget.isCardSample ? 'up to \$$spendLimit' : '\$$spendLimit',
|
||||
widget.isCardSample ? S.of(context).upto(spendLimit) : '\$$spendLimit',
|
||||
style: textXLargeSemiBold(),
|
||||
),
|
||||
SizedBox(height: 16),
|
||||
|
@ -341,7 +342,7 @@ class _IoniaDebitCardState extends State<_IoniaDebitCard> {
|
|||
child: InkWell(
|
||||
onTap: () => _toggleVisibility(),
|
||||
child: Text(
|
||||
_showDetails ? 'Hide Details' : 'Show Details',
|
||||
_showDetails ? S.of(context).hide_details : S.of(context).show_details,
|
||||
style: textSmall(),
|
||||
),
|
||||
),
|
||||
|
|
|
@ -9,8 +9,9 @@ class IoniaViewModel = IoniaViewModelBase with _$IoniaViewModel;
|
|||
abstract class IoniaViewModelBase with Store {
|
||||
IoniaViewModelBase({this.ioniaService})
|
||||
: createUserState = IoniaCreateStateSuccess(),
|
||||
otpState = IoniaOtpSendDisabled(), cardState = IoniaNoCardState() {
|
||||
_getCard();
|
||||
otpState = IoniaOtpSendDisabled(),
|
||||
cardState = IoniaNoCardState() {
|
||||
_getCard();
|
||||
_getAuthStatus().then((value) => isLoggedIn = value);
|
||||
}
|
||||
|
||||
|
@ -44,8 +45,8 @@ abstract class IoniaViewModelBase with Store {
|
|||
await ioniaService.createUser(email);
|
||||
|
||||
createUserState = IoniaCreateStateSuccess();
|
||||
} catch (e) {
|
||||
createUserState = IoniaCreateStateFailure(error: 'Something went wrong!');
|
||||
} on Exception catch (e) {
|
||||
createUserState = IoniaCreateStateFailure(error: e.toString());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -71,21 +72,18 @@ abstract class IoniaViewModelBase with Store {
|
|||
final card = await ioniaService.createCard();
|
||||
createCardState = IoniaCreateCardSuccess();
|
||||
return card;
|
||||
} catch (e) {
|
||||
final error = e as Exception;
|
||||
createCardState = IoniaCreateCardFailure(error: error.toString());
|
||||
} on Exception catch (e) {
|
||||
createCardState = IoniaCreateCardFailure(error: e.toString());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
Future<void> _getCard() async {
|
||||
|
||||
cardState = IoniaFetchingCard();
|
||||
try {
|
||||
final card = await ioniaService.getCard();
|
||||
|
||||
cardState = IoniaCardSuccess(card: card);
|
||||
|
||||
} catch (_) {
|
||||
cardState = IoniaFetchCardFailure();
|
||||
}
|
||||
|
|
|
@ -560,5 +560,29 @@
|
|||
"please_reference_document": "Please reference the documents below for more information.",
|
||||
"cardholder_agreement": "Cardholder Agreement",
|
||||
"e_sign_consent": "E-Sign Consent",
|
||||
"agree_and_continue": "Agree & Continue"
|
||||
"agree_and_continue": "Agree & Continue",
|
||||
"email_address": "Email Address",
|
||||
"agree_to": "By creating account you agree to the ",
|
||||
"and": "and",
|
||||
"enter_code": "Enter code",
|
||||
"congratulations": "Congratulations!",
|
||||
"you_now_have_debit_card": "You now have a debit card",
|
||||
"min_amount" : "Min: ${value}",
|
||||
"max_amount" : "Max: ${value}",
|
||||
"enter_amount": "Enter Amount",
|
||||
"billing_address_info": "If asked for a billing address, provide your shipping address",
|
||||
"order_physical_card": "Order Physical Card",
|
||||
"add_value": "Add value",
|
||||
"activate": "Activate",
|
||||
"get_a": "Get a ",
|
||||
"digital_and_physical_card": " digital and physical prepaid debit card",
|
||||
"get_card_note": " that you can reload with digital currencies. No additional information needed!",
|
||||
"signup_for_card_accept_terms": "Sign up for the card and accept the terms.",
|
||||
"add_fund_to_card": "Add prepaid funds to the cards (up to ${value})",
|
||||
"use_card_info_two": "Funds are converted to USD when the held in the prepaid account, not in digital currencies.",
|
||||
"use_card_info_three": "Use the digital card online or with contactless payment methods.",
|
||||
"optionally_order_card": "Optionally order a physical card.",
|
||||
"hide_details" : "Hide Details",
|
||||
"show_details" : "Show Details",
|
||||
"upto": "up to ${value}"
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue