CAKE-194 | added pre seed page to app; called pre seed page when creating new wallet from welcome an wallet list pages; added images to assets
OleksandrSobol committed
Nov 27, 2020 at 13:08 UTC
3ebc0627e76ce4eccc4f20cce5fef3945ba823e7
11 files changed
+84
-3
assets/images/2.0x/pre_seed_dark.png
Binary files /dev/null and b/assets/images/2.0x/pre_seed_dark.png differ
assets/images/2.0x/pre_seed_light.png
Binary files /dev/null and b/assets/images/2.0x/pre_seed_light.png differ
assets/images/3.0x/pre_seed_dark.png
Binary files /dev/null and b/assets/images/3.0x/pre_seed_dark.png differ
assets/images/3.0x/pre_seed_light.png
Binary files /dev/null and b/assets/images/3.0x/pre_seed_light.png differ
assets/images/pre_seed_dark.png
Binary files /dev/null and b/assets/images/pre_seed_dark.png differ
assets/images/pre_seed_light.png
Binary files /dev/null and b/assets/images/pre_seed_light.png differ
lib/di.dart
+3
@@ -21,6 +21,7 @@ import 'package:cake_wallet/src/screens/nodes/nodes_list_page.dart';
21
import 'package:cake_wallet/src/screens/pin_code/pin_code_widget.dart';
22
import 'package:cake_wallet/src/screens/rescan/rescan_page.dart';
23
import 'package:cake_wallet/src/screens/restore/wallet_restore_page.dart';
24
+import 'package:cake_wallet/src/screens/seed/pre_seed_page.dart';
25
import 'package:cake_wallet/src/screens/seed/wallet_seed_page.dart';
26
import 'package:cake_wallet/src/screens/send/send_template_page.dart';
27
import 'package:cake_wallet/src/screens/settings/change_language.dart';
@@ -405,4 +406,6 @@ Future setup(
406
transactionInfo,
407
getIt.get<SettingsStore>().shouldSaveRecipientAddress,
408
transactionDescriptionBox));
409
+
410
+ getIt.registerFactory(() => PreSeedPage());
411
}
lib/router.dart
+7
-2
@@ -2,6 +2,7 @@ import 'package:cake_wallet/entities/contact_record.dart';
2
import 'package:cake_wallet/entities/transaction_description.dart';
3
import 'package:cake_wallet/src/screens/pin_code/pin_code_widget.dart';
4
import 'package:cake_wallet/src/screens/restore/wallet_restore_page.dart';
5
+import 'package:cake_wallet/src/screens/seed/pre_seed_page.dart';
6
import 'package:cake_wallet/store/settings_store.dart';
7
import 'package:flutter/cupertino.dart';
8
import 'package:flutter/material.dart';
@@ -64,14 +65,14 @@ Route<dynamic> createRoute(RouteSettings settings) {
65
(PinCodeState<PinCodeWidget> context, dynamic _) async {
66
try {
67
context.changeProcessText(
67
- 'Creating new wallet'); // FIXME: Unnamed constant
68
+ S.current.creating_new_wallet);
69
final newWalletVM =
70
getIt.get<WalletNewVM>(param1: WalletType.monero);
71
await newWalletVM.create(
72
options: 'English'); // FIXME: Unnamed constant
73
context.hideProgressText();
74
await Navigator.of(context.context)
74
- .pushNamed(Routes.seed, arguments: true);
75
+ .pushNamed(Routes.preSeed);
76
} catch (e) {
77
context.changeProcessText('Error: ${e.toString()}');
78
}
@@ -322,6 +323,10 @@ Route<dynamic> createRoute(RouteSettings settings) {
323
return MaterialPageRoute<void>(
324
builder: (_) => getIt.get<LanguageListPage>());
325
326
+ case Routes.preSeed:
327
+ return MaterialPageRoute<void>(
328
+ builder: (_) => getIt.get<PreSeedPage>());
329
+
330
default:
331
return MaterialPageRoute<void>(
332
builder: (_) => Scaffold(
lib/routes.dart
+1
@@ -47,4 +47,5 @@ class Routes {
47
static const exchangeTemplate = '/exchange_template';
48
static const restoreWalletType = '/restore_wallet_type';
49
static const restoreWallet = '/restore_wallet';
50
+ static const preSeed = '/pre_seed';
51
}
\ No newline at end of file
lib/src/screens/seed/pre_seed_page.dart
new
+72
@@ -0,0 +1,72 @@
1
+import 'package:cake_wallet/di.dart';
2
+import 'package:cake_wallet/routes.dart';
3
+import 'package:cake_wallet/store/settings_store.dart';
4
+import 'package:flutter/cupertino.dart';
5
+import 'package:flutter/material.dart';
6
+import 'package:cake_wallet/generated/i18n.dart';
7
+import 'package:cake_wallet/src/widgets/primary_button.dart';
8
+import 'package:cake_wallet/src/screens/base_page.dart';
9
+
10
+class PreSeedPage extends BasePage {
11
+ static final imageLight = Image.asset('assets/images/pre_seed_light.png');
12
+ static final imageDark = Image.asset('assets/images/pre_seed_dark.png');
13
+
14
+ @override
15
+ Widget leading(BuildContext context) => null;
16
+
17
+ @override
18
+ String get title => 'IMPORTANT';
19
+
20
+ @override
21
+ Widget body(BuildContext context) {
22
+ final image =
23
+ getIt.get<SettingsStore>().isDarkTheme ? imageDark : imageLight;
24
+
25
+ return Container(
26
+ padding: EdgeInsets.all(24),
27
+ child: Column(
28
+ children: [
29
+ Flexible(
30
+ flex: 2,
31
+ child: AspectRatio(
32
+ aspectRatio: 1,
33
+ child: FittedBox(child: image, fit: BoxFit.contain))),
34
+ Flexible(
35
+ flex: 3,
36
+ child: Column(
37
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
38
+ children: [
39
+ Padding(
40
+ padding:
41
+ EdgeInsets.only(top: 70, left: 16, right: 16),
42
+ child: Text(
43
+ '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.',
44
+ textAlign: TextAlign.center,
45
+ style: TextStyle(
46
+ fontSize: 14,
47
+ fontWeight: FontWeight.normal,
48
+ color: Theme.of(context)
49
+ .primaryTextTheme
50
+ .caption
51
+ .color),
52
+ ),
53
+ ),
54
+ PrimaryButton(
55
+ onPressed: () =>
56
+ Navigator.of(context).popAndPushNamed(Routes.seed,
57
+ arguments: true),
58
+ text: 'I understand. Show me my seed',
59
+ color: Theme.of(context)
60
+ .accentTextTheme
61
+ .body2
62
+ .color,
63
+ textColor: Colors.white)
64
+ ],
65
+ )
66
+ )
67
+ ],
68
+ ),
69
+ );
70
+ }
71
+
72
+}
\ No newline at end of file
lib/src/screens/wallet_list/wallet_list_page.dart
+1
-1
@@ -243,7 +243,7 @@ class WalletListBodyState extends State<WalletListBody> {
243
changeProcessText(S.of(context).creating_new_wallet);
244
await widget.walletListViewModel.walletNewVM.create(options: 'English'); // FIXME: Unnamed constant
245
hideProgressText();
246
- await Navigator.of(context).pushNamed(Routes.seed, arguments: true);
246
+ await Navigator.of(context).pushNamed(Routes.preSeed);
247
} catch(e) {
248
changeProcessText(S.of(context).creating_new_wallet_error(e.toString()));
249
}