added fucntion to WalletCreationVMBase to generate random wallet names. Wallet name generator follows this format <ADJECTIVE><space><NOUN>

Tanner Silva committed Oct 19, 2020 at 12:21 UTC d7f829042be9b120b3269614cd7aeaf1e368b27d
3 files changed +214 -178
ios/Flutter/.last_build_id
+1 -1
@@ -1 +1 @@
1 -4dc2ef1ba73deeed13cd85894dacb10b
\ No newline at end of file
1 +f88b397cc50258e916c86427fe071d09
\ No newline at end of file
lib/src/screens/disclaimer/disclaimer_page.dart
+193 -177
@@ -24,7 +24,8 @@ class DisclaimerPage extends BasePage {
24 isReadOnly ? super.leading(context) : null;
25
26 @override
27 - Widget body(BuildContext context) => DisclaimerPageBody(isReadOnly: isReadOnly);
27 + Widget body(BuildContext context) =>
28 + DisclaimerPageBody(isReadOnly: isReadOnly);
29 }
30
31 class DisclaimerPageBody extends StatefulWidget {
@@ -37,7 +38,6 @@ class DisclaimerPageBody extends StatefulWidget {
38 }
39
40 class DisclaimerBodyState extends State<DisclaimerPageBody> {
40 -
41 static const xmrtoUrl = 'https://xmr.to/terms-of-service';
42 static const changenowUrl = 'https://changenow.io/terms-of-use';
43 static const morphUrl = 'http://morphtoken.com/terms';
@@ -69,173 +69,183 @@ class DisclaimerBodyState extends State<DisclaimerPageBody> {
69 SizedBox(height: 10.0),
70 Expanded(
71 child: Stack(
72 - children: <Widget>[
73 - SingleChildScrollView(
74 - padding: EdgeInsets.only(left: 24.0, right: 24.0),
75 - child: Column(
72 + children: <Widget>[
73 + SingleChildScrollView(
74 + padding: EdgeInsets.only(left: 24.0, right: 24.0),
75 + child: Column(
76 + children: <Widget>[
77 + Row(
78 children: <Widget>[
77 - Row(
78 - children: <Widget>[
79 - Expanded(
80 - child: Text(
81 - 'Terms and conditions',
82 - textAlign: TextAlign.center,
83 - style: TextStyle(
84 - fontSize: 20.0,
85 - fontWeight: FontWeight.bold,
86 - color: Theme.of(context).primaryTextTheme.title.color
87 - ),
88 - ),
89 - )
90 - ],
91 - ),
92 - SizedBox(
93 - height: 20.0,
94 - ),
95 - Row(
96 - children: <Widget>[
97 - Expanded(
98 - child: Text(
99 - 'Legal Disclaimer\nAnd\nTerms of Use',
100 - textAlign: TextAlign.center,
101 - style: TextStyle(
102 - fontSize: 12.0,
103 - fontWeight: FontWeight.bold,
104 - color: Theme.of(context).primaryTextTheme.title.color
105 - ),
106 - ),
107 - )
108 - ],
109 - ),
110 - SizedBox(
111 - height: 16.0,
112 - ),
113 - Row(
114 - children: <Widget>[
115 - Expanded(
116 - child: Text(
117 - _fileText,
118 - style: TextStyle(
119 - fontSize: 12.0,
120 - fontWeight: FontWeight.normal,
121 - color: Theme.of(context).primaryTextTheme.title.color
122 - ),
123 - ))
124 - ],
125 - ),
126 - SizedBox(
127 - height: 16.0,
128 - ),
129 - Row(
130 - mainAxisAlignment: MainAxisAlignment.start,
131 - children: <Widget>[
132 - Expanded(
133 - child: Text(
134 - 'Other Terms and Conditions',
135 - textAlign: TextAlign.left,
136 - style: TextStyle(
137 - fontSize: 14.0,
138 - fontWeight: FontWeight.bold,
139 - color: Theme.of(context).primaryTextTheme.title.color
140 - ),
141 - ),
142 - )
143 - ],
144 - ),
145 - SizedBox(
146 - height: 16.0,
147 - ),
148 - Row(
149 - mainAxisAlignment: MainAxisAlignment.start,
150 - children: <Widget>[
151 - Expanded(
152 - child: GestureDetector(
153 - onTap: () => launchUrl(xmrtoUrl),
154 - child: Text(
155 - xmrtoUrl,
156 - textAlign: TextAlign.left,
157 - style: TextStyle(
158 - color: Palette.blueCraiola,
159 - fontSize: 14.0,
160 - fontWeight: FontWeight.normal,
161 - decoration: TextDecoration.underline),
162 - ),
163 - ))
164 - ],
165 - ),
166 - SizedBox(
167 - height: 16.0,
168 - ),
169 - Row(
170 - mainAxisAlignment: MainAxisAlignment.start,
171 - children: <Widget>[
172 - Expanded(
173 - child: GestureDetector(
174 - onTap: () => launchUrl(changenowUrl),
175 - child: Text(
176 - changenowUrl,
177 - textAlign: TextAlign.left,
178 - style: TextStyle(
179 - color: Palette.blueCraiola,
180 - fontSize: 14.0,
181 - fontWeight: FontWeight.normal,
182 - decoration: TextDecoration.underline),
183 - ),
184 - ))
185 - ],
186 - ),
187 - SizedBox(
188 - height: 16.0,
189 - ),
190 - Row(
191 - mainAxisAlignment: MainAxisAlignment.start,
192 - children: <Widget>[
193 - Expanded(
194 - child: GestureDetector(
195 - onTap: () => launchUrl(morphUrl),
196 - child: Text(
197 - morphUrl,
198 - textAlign: TextAlign.left,
199 - style: TextStyle(
200 - color: Palette.blueCraiola,
201 - fontSize: 14.0,
202 - fontWeight: FontWeight.normal,
203 - decoration: TextDecoration.underline),
204 - ),
205 - ))
206 - ],
207 - ),
208 - SizedBox(
209 - height: 16.0,
79 + Expanded(
80 + child: Text(
81 + 'Terms and conditions',
82 + textAlign: TextAlign.center,
83 + style: TextStyle(
84 + fontSize: 20.0,
85 + fontWeight: FontWeight.bold,
86 + color: Theme.of(context)
87 + .primaryTextTheme
88 + .title
89 + .color),
90 + ),
91 )
92 ],
93 ),
213 - ),
214 - Container(
215 - alignment: Alignment.bottomCenter,
216 - child: Container(
217 - height: 12.0,
218 - child: ClipRect(
219 - child: BackdropFilter(
220 - filter: ImageFilter.blur(sigmaX: 0.7, sigmaY: 0.7),
221 - child: Container(
222 - decoration: BoxDecoration(
223 - gradient: LinearGradient(
224 - colors: [
225 - Theme.of(context).backgroundColor.withOpacity(0.0),
226 - Theme.of(context).backgroundColor,
227 - ],
228 - begin: FractionalOffset.topCenter,
229 - end: FractionalOffset.bottomCenter,
230 - ),
231 - ),
94 + SizedBox(
95 + height: 20.0,
96 + ),
97 + Row(
98 + children: <Widget>[
99 + Expanded(
100 + child: Text(
101 + 'Legal Disclaimer\nAnd\nTerms of Use',
102 + textAlign: TextAlign.center,
103 + style: TextStyle(
104 + fontSize: 12.0,
105 + fontWeight: FontWeight.bold,
106 + color: Theme.of(context)
107 + .primaryTextTheme
108 + .title
109 + .color),
110 + ),
111 + )
112 + ],
113 + ),
114 + SizedBox(
115 + height: 16.0,
116 + ),
117 + Row(
118 + children: <Widget>[
119 + Expanded(
120 + child: Text(
121 + _fileText,
122 + style: TextStyle(
123 + fontSize: 12.0,
124 + fontWeight: FontWeight.normal,
125 + color: Theme.of(context)
126 + .primaryTextTheme
127 + .title
128 + .color),
129 + ))
130 + ],
131 + ),
132 + SizedBox(
133 + height: 16.0,
134 + ),
135 + Row(
136 + mainAxisAlignment: MainAxisAlignment.start,
137 + children: <Widget>[
138 + Expanded(
139 + child: Text(
140 + 'Other Terms and Conditions',
141 + textAlign: TextAlign.left,
142 + style: TextStyle(
143 + fontSize: 14.0,
144 + fontWeight: FontWeight.bold,
145 + color: Theme.of(context)
146 + .primaryTextTheme
147 + .title
148 + .color),
149 + ),
150 + )
151 + ],
152 + ),
153 + SizedBox(
154 + height: 16.0,
155 + ),
156 + Row(
157 + mainAxisAlignment: MainAxisAlignment.start,
158 + children: <Widget>[
159 + Expanded(
160 + child: GestureDetector(
161 + onTap: () => launchUrl(xmrtoUrl),
162 + child: Text(
163 + xmrtoUrl,
164 + textAlign: TextAlign.left,
165 + style: TextStyle(
166 + color: Palette.blueCraiola,
167 + fontSize: 14.0,
168 + fontWeight: FontWeight.normal,
169 + decoration: TextDecoration.underline),
170 + ),
171 + ))
172 + ],
173 + ),
174 + SizedBox(
175 + height: 16.0,
176 + ),
177 + Row(
178 + mainAxisAlignment: MainAxisAlignment.start,
179 + children: <Widget>[
180 + Expanded(
181 + child: GestureDetector(
182 + onTap: () => launchUrl(changenowUrl),
183 + child: Text(
184 + changenowUrl,
185 + textAlign: TextAlign.left,
186 + style: TextStyle(
187 + color: Palette.blueCraiola,
188 + fontSize: 14.0,
189 + fontWeight: FontWeight.normal,
190 + decoration: TextDecoration.underline),
191 + ),
192 + ))
193 + ],
194 + ),
195 + SizedBox(
196 + height: 16.0,
197 + ),
198 + Row(
199 + mainAxisAlignment: MainAxisAlignment.start,
200 + children: <Widget>[
201 + Expanded(
202 + child: GestureDetector(
203 + onTap: () => launchUrl(morphUrl),
204 + child: Text(
205 + morphUrl,
206 + textAlign: TextAlign.left,
207 + style: TextStyle(
208 + color: Palette.blueCraiola,
209 + fontSize: 14.0,
210 + fontWeight: FontWeight.normal,
211 + decoration: TextDecoration.underline),
212 + ),
213 + ))
214 + ],
215 + ),
216 + SizedBox(
217 + height: 16.0,
218 + )
219 + ],
220 + ),
221 + ),
222 + Container(
223 + alignment: Alignment.bottomCenter,
224 + child: Container(
225 + height: 12.0,
226 + child: ClipRect(
227 + child: BackdropFilter(
228 + filter: ImageFilter.blur(sigmaX: 0.7, sigmaY: 0.7),
229 + child: Container(
230 + decoration: BoxDecoration(
231 + gradient: LinearGradient(
232 + colors: [
233 + Theme.of(context)
234 + .backgroundColor
235 + .withOpacity(0.0),
236 + Theme.of(context).backgroundColor,
237 + ],
238 + begin: FractionalOffset.topCenter,
239 + end: FractionalOffset.bottomCenter,
240 ),
241 ),
242 ),
243 ),
236 - )
237 - ],
238 - )),
244 + ),
245 + ),
246 + )
247 + ],
248 + )),
249 if (!widget.isReadOnly) ...[
250 Row(
251 children: <Widget>[
@@ -260,25 +270,31 @@ class DisclaimerBodyState extends State<DisclaimerPageBody> {
270 ),
271 decoration: BoxDecoration(
272 border: Border.all(
263 - color: Theme.of(context).primaryTextTheme.caption.color, width: 1.0),
264 - borderRadius: BorderRadius.all(
265 - Radius.circular(8.0)),
273 + color: Theme.of(context)
274 + .primaryTextTheme
275 + .caption
276 + .color,
277 + width: 1.0),
278 + borderRadius:
279 + BorderRadius.all(Radius.circular(8.0)),
280 color: Theme.of(context).backgroundColor),
281 child: _checked
268 - ? Icon(
269 - Icons.check,
270 - color: Colors.blue,
271 - size: 20.0,
272 - )
273 - : null,
282 + ? Icon(
283 + Icons.check,
284 + color: Colors.blue,
285 + size: 20.0,
286 + )
287 + : null,
288 ),
289 Text(
290 'I agree to Terms of Use',
291 style: TextStyle(
292 fontWeight: FontWeight.bold,
293 fontSize: 14.0,
280 - color: Theme.of(context).primaryTextTheme.title.color
281 - ),
294 + color: Theme.of(context)
295 + .primaryTextTheme
296 + .title
297 + .color),
298 )
299 ],
300 ),
@@ -287,12 +303,12 @@ class DisclaimerBodyState extends State<DisclaimerPageBody> {
303 ],
304 ),
305 Container(
290 - padding:
291 - EdgeInsets.only(left: 24.0, right: 24.0, bottom: 24.0),
306 + padding: EdgeInsets.only(left: 24.0, right: 24.0, bottom: 24.0),
307 child: PrimaryButton(
293 - onPressed: _checked ? () =>
294 - Navigator.of(context).popAndPushNamed(Routes.welcome)
295 - : null,
308 + onPressed: _checked
309 + ? () =>
310 + Navigator.of(context).popAndPushNamed(Routes.welcome)
311 + : null,
312 text: 'Accept',
313 color: Colors.green,
314 textColor: Colors.white,
lib/view_model/wallet_creation_vm.dart
+20
@@ -8,6 +8,8 @@ import 'package:cake_wallet/entities/pathForWallet.dart';
8 import 'package:cake_wallet/entities/wallet_info.dart';
9 import 'package:cake_wallet/entities/wallet_type.dart';
10 import 'package:cake_wallet/store/app_store.dart';
11 +import 'package:flutter/services.dart';
12 +import 'dart:math';
13
14 part 'wallet_creation_vm.g.dart';
15
@@ -31,6 +33,24 @@ abstract class WalletCreationVMBase with Store {
33 final Box<WalletInfo> _walletInfoSource;
34 final AppStore _appStore;
35
36 + Future<String> generateName() async {
37 + final adjectiveStringRaw =
38 + await rootBundle.loadString('assets/text/Wallet_Adjectives.txt');
39 + final nounStringRaw =
40 + await rootBundle.loadString('assets/text/Wallet_Nouns.txt');
41 +
42 + final randomThing = new Random();
43 +
44 + final adjectives = new List<String>.from(adjectiveStringRaw.split("\n"));
45 + final nouns = new List<String>.from(nounStringRaw.split("\n"));
46 +
47 + final chosenAdjective = adjectives[randomThing.nextInt(adjectives.length)];
48 + final chosenNoun = nouns[randomThing.nextInt(nouns.length)];
49 +
50 + final returnString = chosenAdjective + " " + chosenNoun;
51 + return returnString;
52 + }
53 +
54 Future<void> create({dynamic options}) async {
55 try {
56 state = IsExecutingState();