diff --git a/assets/images/2.0x/pre_seed_dark.png b/assets/images/2.0x/pre_seed_dark.png new file mode 100755 index 000000000..2bb3b8e65 Binary files /dev/null and b/assets/images/2.0x/pre_seed_dark.png differ diff --git a/assets/images/2.0x/pre_seed_light.png b/assets/images/2.0x/pre_seed_light.png new file mode 100755 index 000000000..b198effad Binary files /dev/null and b/assets/images/2.0x/pre_seed_light.png differ diff --git a/assets/images/3.0x/pre_seed_dark.png b/assets/images/3.0x/pre_seed_dark.png new file mode 100755 index 000000000..632f2bb1e Binary files /dev/null and b/assets/images/3.0x/pre_seed_dark.png differ diff --git a/assets/images/3.0x/pre_seed_light.png b/assets/images/3.0x/pre_seed_light.png new file mode 100755 index 000000000..329fce10b Binary files /dev/null and b/assets/images/3.0x/pre_seed_light.png differ diff --git a/assets/images/pre_seed_dark.png b/assets/images/pre_seed_dark.png new file mode 100755 index 000000000..ed12c730a Binary files /dev/null and b/assets/images/pre_seed_dark.png differ diff --git a/assets/images/pre_seed_light.png b/assets/images/pre_seed_light.png new file mode 100755 index 000000000..bb95a6567 Binary files /dev/null and b/assets/images/pre_seed_light.png differ diff --git a/lib/di.dart b/lib/di.dart index 1571c925b..69b48056c 100644 --- a/lib/di.dart +++ b/lib/di.dart @@ -21,6 +21,7 @@ import 'package:cake_wallet/src/screens/nodes/nodes_list_page.dart'; import 'package:cake_wallet/src/screens/pin_code/pin_code_widget.dart'; import 'package:cake_wallet/src/screens/rescan/rescan_page.dart'; import 'package:cake_wallet/src/screens/restore/wallet_restore_page.dart'; +import 'package:cake_wallet/src/screens/seed/pre_seed_page.dart'; import 'package:cake_wallet/src/screens/seed/wallet_seed_page.dart'; import 'package:cake_wallet/src/screens/send/send_template_page.dart'; import 'package:cake_wallet/src/screens/settings/change_language.dart'; @@ -405,4 +406,6 @@ Future setup( transactionInfo, getIt.get().shouldSaveRecipientAddress, transactionDescriptionBox)); + + getIt.registerFactory(() => PreSeedPage()); } diff --git a/lib/router.dart b/lib/router.dart index acad61d04..e9174e694 100644 --- a/lib/router.dart +++ b/lib/router.dart @@ -2,6 +2,7 @@ import 'package:cake_wallet/entities/contact_record.dart'; import 'package:cake_wallet/entities/transaction_description.dart'; import 'package:cake_wallet/src/screens/pin_code/pin_code_widget.dart'; import 'package:cake_wallet/src/screens/restore/wallet_restore_page.dart'; +import 'package:cake_wallet/src/screens/seed/pre_seed_page.dart'; import 'package:cake_wallet/store/settings_store.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -64,14 +65,14 @@ Route createRoute(RouteSettings settings) { (PinCodeState context, dynamic _) async { try { context.changeProcessText( - 'Creating new wallet'); // FIXME: Unnamed constant + S.current.creating_new_wallet); final newWalletVM = getIt.get(param1: WalletType.monero); await newWalletVM.create( options: 'English'); // FIXME: Unnamed constant context.hideProgressText(); await Navigator.of(context.context) - .pushNamed(Routes.seed, arguments: true); + .pushNamed(Routes.preSeed); } catch (e) { context.changeProcessText('Error: ${e.toString()}'); } @@ -322,6 +323,10 @@ Route createRoute(RouteSettings settings) { return MaterialPageRoute( builder: (_) => getIt.get()); + case Routes.preSeed: + return MaterialPageRoute( + builder: (_) => getIt.get()); + default: return MaterialPageRoute( builder: (_) => Scaffold( diff --git a/lib/routes.dart b/lib/routes.dart index 13a365990..a9c9a5b34 100644 --- a/lib/routes.dart +++ b/lib/routes.dart @@ -47,4 +47,5 @@ class Routes { static const exchangeTemplate = '/exchange_template'; static const restoreWalletType = '/restore_wallet_type'; static const restoreWallet = '/restore_wallet'; + static const preSeed = '/pre_seed'; } \ No newline at end of file diff --git a/lib/src/screens/seed/pre_seed_page.dart b/lib/src/screens/seed/pre_seed_page.dart new file mode 100644 index 000000000..f07cf8427 --- /dev/null +++ b/lib/src/screens/seed/pre_seed_page.dart @@ -0,0 +1,72 @@ +import 'package:cake_wallet/di.dart'; +import 'package:cake_wallet/routes.dart'; +import 'package:cake_wallet/store/settings_store.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.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'; + +class PreSeedPage extends BasePage { + static final imageLight = Image.asset('assets/images/pre_seed_light.png'); + static final imageDark = Image.asset('assets/images/pre_seed_dark.png'); + + @override + Widget leading(BuildContext context) => null; + + @override + String get title => 'IMPORTANT'; + + @override + Widget body(BuildContext context) { + final image = + getIt.get().isDarkTheme ? imageDark : imageLight; + + return Container( + padding: EdgeInsets.all(24), + child: Column( + children: [ + Flexible( + flex: 2, + child: AspectRatio( + aspectRatio: 1, + child: FittedBox(child: image, fit: BoxFit.contain))), + Flexible( + flex: 3, + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Padding( + padding: + EdgeInsets.only(top: 70, left: 16, right: 16), + child: Text( + 'On the next page you will see a series of 25 words. This is your unique and private seed and it is the ONLY way to recover your wallet in case of loss or malfunction. It is YOUR responsibility to write it down and store it in a safe place outside of the Cake Wallet app.', + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.normal, + color: Theme.of(context) + .primaryTextTheme + .caption + .color), + ), + ), + PrimaryButton( + onPressed: () => + Navigator.of(context).popAndPushNamed(Routes.seed, + arguments: true), + text: 'I understand. Show me my seed', + color: Theme.of(context) + .accentTextTheme + .body2 + .color, + textColor: Colors.white) + ], + ) + ) + ], + ), + ); + } + +} \ No newline at end of file diff --git a/lib/src/screens/wallet_list/wallet_list_page.dart b/lib/src/screens/wallet_list/wallet_list_page.dart index 5162b1c5b..1b15a8e0e 100644 --- a/lib/src/screens/wallet_list/wallet_list_page.dart +++ b/lib/src/screens/wallet_list/wallet_list_page.dart @@ -243,7 +243,7 @@ class WalletListBodyState extends State { changeProcessText(S.of(context).creating_new_wallet); await widget.walletListViewModel.walletNewVM.create(options: 'English'); // FIXME: Unnamed constant hideProgressText(); - await Navigator.of(context).pushNamed(Routes.seed, arguments: true); + await Navigator.of(context).pushNamed(Routes.preSeed); } catch(e) { changeProcessText(S.of(context).creating_new_wallet_error(e.toString())); }