Add Welcome and Auth screens for Cake Phone

This commit is contained in:
OmarHatem28 2022-06-30 18:44:18 +02:00
parent 02533d68a0
commit 9e3a563419
5 changed files with 227 additions and 1 deletions

View file

@ -4,6 +4,7 @@ import 'package:cake_wallet/src/screens/backup/backup_page.dart';
import 'package:cake_wallet/src/screens/backup/edit_backup_password_page.dart';
import 'package:cake_wallet/src/screens/buy/buy_webview_page.dart';
import 'package:cake_wallet/src/screens/buy/pre_order_page.dart';
import 'package:cake_wallet/src/screens/cake_phone/cake_phone_auth_page.dart';
import 'package:cake_wallet/src/screens/order_details/order_details_page.dart';
import 'package:cake_wallet/src/screens/pin_code/pin_code_widget.dart';
import 'package:cake_wallet/src/screens/restore/restore_from_backup_page.dart';
@ -63,6 +64,7 @@ import 'package:flutter/services.dart';
import 'package:cake_wallet/wallet_types.g.dart';
import 'package:cake_wallet/src/screens/dashboard/widgets/address_page.dart';
import 'package:cake_wallet/src/screens/receive/fullscreen_qr_page.dart';
import 'package:cake_wallet/src/screens/cake_phone/cake_phone_welcome_page.dart';
RouteSettings currentRouteSettings;
@ -401,6 +403,18 @@ Route<dynamic> createRoute(RouteSettings settings) {
param2: args['isLight'] as bool,
));
case Routes.cakePhoneWelcome:
return MaterialPageRoute<CakePhoneWelcomePage>(
builder: (_) => CakePhoneWelcomePage(),
);
case Routes.cakePhoneAuth:
final isLogin = settings.arguments as bool ?? false;
return MaterialPageRoute<CakePhoneWelcomePage>(
builder: (_) => CakePhoneAuthPage(isLogin: isLogin),
);
default:
return MaterialPageRoute<void>(
builder: (_) => Scaffold(

View file

@ -60,4 +60,6 @@ class Routes {
static const moneroNewWalletFromWelcome = '/monero_new_wallet';
static const addressPage = '/address_page';
static const fullscreenQR = '/fullscreen_qr';
static const cakePhoneWelcome = '/cake_phone_welcome';
static const cakePhoneAuth = '/cake_phone_auth';
}

View file

@ -0,0 +1,108 @@
import 'package:cake_wallet/src/widgets/base_text_form_field.dart';
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
import 'package:cake_wallet/routes.dart';
import 'package:cake_wallet/generated/i18n.dart';
import 'package:cake_wallet/src/widgets/primary_button.dart';
import 'package:cake_wallet/src/screens/base_page.dart';
import 'package:cake_wallet/src/widgets/scollable_with_bottom_section.dart';
class CakePhoneAuthPage extends BasePage {
CakePhoneAuthPage({@required this.isLogin});
final bool isLogin;
@override
Widget body(BuildContext context) => CakePhoneAuthBody(isLogin);
@override
Widget middle(BuildContext context) {
return Text(
isLogin ? S.of(context).login : S.of(context).signup,
style: TextStyle(
fontSize: 22,
fontWeight: FontWeight.w600,
fontFamily: 'Lato',
color: titleColor ?? Theme.of(context).primaryTextTheme.title.color),
);
}
}
class CakePhoneAuthBody extends StatefulWidget {
CakePhoneAuthBody(this.isLogin);
final bool isLogin;
@override
CakePhoneAuthBodyState createState() => CakePhoneAuthBodyState();
}
class CakePhoneAuthBodyState extends State<CakePhoneAuthBody> {
final _emailController = TextEditingController();
@override
Widget build(BuildContext context) {
return Container(
padding: EdgeInsets.only(top: 16),
child: ScrollableWithBottomSection(
contentPadding: EdgeInsets.fromLTRB(24, 100, 24, 20),
content: BaseTextFormField(
controller: _emailController,
keyboardType: TextInputType.emailAddress,
maxLines: 1,
hintText: S.of(context).emailAddress,
),
bottomSectionPadding: EdgeInsets.only(bottom: 24, right: 24, left: 24),
bottomSection: Column(
children: <Widget>[
PrimaryButton(
onPressed: () {},
text: widget.isLogin ? S.of(context).login : S.of(context).create_account,
color: Theme.of(context).accentTextTheme.body2.color,
textColor: Colors.white,
),
Padding(
padding: const EdgeInsets.only(bottom: 8, top: 16),
child: RichText(
text: TextSpan(
children: [
TextSpan(
text: widget.isLogin
? S.of(context).cake_phone_terms_conditions_first_section_login
: S.of(context).cake_phone_terms_conditions_first_section_signup,
),
TextSpan(
text: " ${S.of(context).settings_terms_and_conditions}",
style: TextStyle(
color: Theme.of(context).accentTextTheme.display1.color,
fontWeight: FontWeight.w600,
),
),
TextSpan(
text: " ${S.of(context).and} ",
),
TextSpan(
text: "${S.of(context).privacy_policy} ",
style: TextStyle(
color: Theme.of(context).accentTextTheme.display1.color,
fontWeight: FontWeight.w600,
),
),
TextSpan(
text: S.of(context).cake_phone_terms_conditions_second_section,
),
],
style: TextStyle(
fontSize: 12,
color: Theme.of(context).accentTextTheme.subhead.color,
),
),
textAlign: TextAlign.center,
),
),
],
),
),
);
}
}

View file

@ -0,0 +1,92 @@
import 'package:cake_wallet/routes.dart';
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
import 'package:cake_wallet/generated/i18n.dart';
import 'package:cake_wallet/src/widgets/primary_button.dart';
import 'package:cake_wallet/src/screens/base_page.dart';
import 'package:cake_wallet/src/widgets/scollable_with_bottom_section.dart';
class CakePhoneWelcomePage extends BasePage {
CakePhoneWelcomePage();
@override
Widget body(BuildContext context) => CakePhoneWelcomeBody();
@override
Widget middle(BuildContext context) {
return Text(
S.of(context).welcome_to_cake_phone,
style: TextStyle(
fontSize: 22,
fontWeight: FontWeight.w600,
fontFamily: 'Lato',
color: titleColor ??
Theme.of(context).primaryTextTheme.title.color),
);
}
}
class CakePhoneWelcomeBody extends StatefulWidget {
CakePhoneWelcomeBody();
@override
CakePhoneWelcomeBodyState createState() => CakePhoneWelcomeBodyState();
}
class CakePhoneWelcomeBodyState extends State<CakePhoneWelcomeBody> {
@override
Widget build(BuildContext context) {
return Container(
padding: EdgeInsets.only(top: 16),
child: ScrollableWithBottomSection(
contentPadding: EdgeInsets.fromLTRB(24, 100, 24, 20),
content: Text(
'''Cake Phone allows you to purchase virtual phone numbers with digital assets!
Only an email is required.''',
style: TextStyle(
fontSize: 16,
color: Theme.of(context).primaryTextTheme.title.color,
fontFamily: 'Lato',
),
),
bottomSectionPadding: EdgeInsets.only(bottom: 24, right: 24, left: 24),
bottomSection: Column(
children: <Widget>[
PrimaryButton(
onPressed: () {
Navigator.pushNamed(context, Routes.cakePhoneAuth);
},
text: S.of(context).create_account,
color: Theme.of(context).accentTextTheme.body2.color,
textColor: Colors.white,
),
Padding(
padding: const EdgeInsets.only(bottom: 8, top: 16),
child: Text(
S.of(context).already_have_account,
style: TextStyle(
color: Theme.of(context).primaryTextTheme.title.color,
fontWeight: FontWeight.w500,
),
),
),
InkWell(
onTap: () {
Navigator.pushNamed(context, Routes.cakePhoneAuth, arguments: true);
},
child: Text(
S.of(context).login,
style: TextStyle(
color: Theme.of(context).accentTextTheme.display1.color,
fontSize: 16,
fontWeight: FontWeight.w900,
),
),
),
],
),
),
);
}
}

View file

@ -534,5 +534,15 @@
"search_currency": "Search currency",
"new_template" : "New Template",
"electrum_address_disclaimer": "We generate new addresses each time you use one, but previous addresses continue to work",
"wallet_name_exists": "Wallet with that name has already existed"
"wallet_name_exists": "Wallet with that name has already existed",
"welcome_to_cake_phone": "Welcome to Cake Phone",
"create_account": "Create Account",
"signup": "Sign up",
"already_have_account": "Already have an account?",
"cake_phone_terms_conditions_first_section_signup": "By creating account you agree to the",
"cake_phone_terms_conditions_first_section_login": "You agree to the",
"cake_phone_terms_conditions_second_section": "of Cake Phone, which indicates you will receive all account notices and information electronically to the email address provided",
"privacy_policy": "Privacy Policy",
"and": "and",
"emailAddress": "Email Address"
}