31
import 'package:flutter/material.dart';
32
import 'package:flutter_mobx/flutter_mobx.dart';
33
34
+import '../../../themes/extensions/dashboard_page_theme.dart';
35
+
36
class WalletListPage extends BasePage {
37
WalletListPage({
38
required this.walletListViewModel,
90
width: 36,
91
decoration: BoxDecoration(
92
shape: BoxShape.circle,
91
- color: Theme.of(context).extension<FilterTheme>()!.buttonColor,
93
+ color:
94
+ Theme.of(context).extension<FilterTheme>()!.buttonColor,
95
),
96
child: filterIcon,
97
),
148
color: Theme.of(context).extension<CakeTextTheme>()!.buttonTextColor);
149
150
return Container(
151
+ height: double.infinity,
152
padding: EdgeInsets.only(top: 16),
149
- child: Column(
150
- children: [
151
- Expanded(
152
- child: SingleChildScrollView(
153
- child: Column(
154
- crossAxisAlignment: CrossAxisAlignment.start,
155
- children: [
156
- if (widget.walletListViewModel.multiWalletGroups.isNotEmpty) ...{
157
- Padding(
158
- padding: const EdgeInsets.only(left: 24),
159
- child: Text(
160
- S.current.shared_seed_wallet_groups,
161
- style: TextStyle(
162
- fontSize: 18,
163
- fontWeight: FontWeight.w500,
164
- color: Theme.of(context).extension<CakeTextTheme>()!.titleColor,
165
- ),
153
+
154
+ child: Stack(
155
+ alignment: Alignment.bottomCenter,
156
+ fit: StackFit.expand,
157
+ children: <Widget>[
158
+ SingleChildScrollView(
159
+ child: Column(
160
+ crossAxisAlignment: CrossAxisAlignment.start,
161
+ children: [
162
+ if (widget
163
+ .walletListViewModel.multiWalletGroups.isNotEmpty) ...{
164
+ Padding(
165
+ padding: const EdgeInsets.only(left: 24),
166
+ child: Text(
167
+ S.current.shared_seed_wallet_groups,
168
+ style: TextStyle(
169
+ fontSize: 18,
170
+ fontWeight: FontWeight.w500,
171
+ color: Theme.of(context)
172
+ .extension<CakeTextTheme>()!
173
+ .titleColor,
174
),
175
),
168
- SizedBox(height: 16),
169
- Container(
170
- child: Observer(
171
- builder: (_) => FilteredList(
172
- shrinkWrap: true,
173
- list: widget.walletListViewModel.multiWalletGroups,
174
- updateFunction: widget.walletListViewModel.reorderAccordingToWalletList,
175
- itemBuilder: (context, index) {
176
- final group = widget.walletListViewModel.multiWalletGroups[index];
177
- final groupName = group.groupName ??
178
- '${S.current.wallet_group} ${index + 1}';
176
+ ),
177
+ SizedBox(height: 16),
178
+ Container(
179
+ child: Observer(
180
+ builder: (_) => FilteredList(
181
+ shrinkWrap: true,
182
+ list: widget.walletListViewModel.multiWalletGroups,
183
+ updateFunction: widget
184
+ .walletListViewModel.reorderAccordingToWalletList,
185
+ itemBuilder: (context, index) {
186
+ final group = widget
187
+ .walletListViewModel.multiWalletGroups[index];
188
+ final groupName = group.groupName ??
189
+ '${S.current.wallet_group} ${index + 1}';
190
180
- widget.walletListViewModel.updateTileState(
181
- index,
182
- widget.walletListViewModel.expansionTileStateTrack[index] ?? false,
183
- );
191
+ widget.walletListViewModel.updateTileState(
192
+ index,
193
+ widget.walletListViewModel
194
+ .expansionTileStateTrack[index] ??
195
+ false,
196
+ );
197
185
- return GroupedWalletExpansionTile(
186
- onExpansionChanged: (value) {
187
- widget.walletListViewModel.updateTileState(index, value);
188
- setState(() {});
198
+ return GroupedWalletExpansionTile(
199
+ onExpansionChanged: (value) {
200
+ widget.walletListViewModel
201
+ .updateTileState(index, value);
202
+ setState(() {});
203
+ },
204
+ shouldShowCurrentWalletPointer: true,
205
+ borderRadius: BorderRadius.all(Radius.circular(16)),
206
+ margin: EdgeInsets.only(
207
+ left: 20, right: 20, bottom: 12),
208
+ title: groupName,
209
+ tileKey: ValueKey(
210
+ 'group_wallets_expansion_tile_widget_$index'),
211
+ leadingWidget: Icon(
212
+ Icons.account_balance_wallet_outlined,
213
+ size: 28,
214
+ ),
215
+ trailingWidget: EditWalletButtonWidget(
216
+ width: 74,
217
+ isGroup: true,
218
+ isExpanded: widget.walletListViewModel
219
+ .expansionTileStateTrack[index]!,
220
+ onTap: () {
221
+ final wallet = widget.walletListViewModel
222
+ .convertWalletInfoToWalletListItem(
223
+ group.wallets.first);
224
+ Navigator.of(context).pushNamed(
225
+ Routes.walletEdit,
226
+ arguments: WalletEditPageArguments(
227
+ walletListViewModel:
228
+ widget.walletListViewModel,
229
+ editingWallet: wallet,
230
+ isWalletGroup: true,
231
+ groupName: groupName,
232
+ parentAddress: group.parentAddress,
233
+ ),
234
+ );
235
},
190
- shouldShowCurrentWalletPointer: true,
191
- borderRadius: BorderRadius.all(Radius.circular(16)),
192
- margin: EdgeInsets.only(left: 20, right: 20, bottom: 12),
193
- title: groupName,
194
- tileKey: ValueKey('group_wallets_expansion_tile_widget_$index'),
195
- leadingWidget: Icon(
196
- Icons.account_balance_wallet_outlined,
197
- size: 28,
198
- ),
199
- trailingWidget: EditWalletButtonWidget(
200
- width: 74,
201
- isGroup: true,
202
- isExpanded: widget.walletListViewModel.expansionTileStateTrack[index]!,
203
- onTap: () {
204
- final wallet = widget.walletListViewModel
205
- .convertWalletInfoToWalletListItem(group.wallets.first);
206
- Navigator.of(context).pushNamed(
207
- Routes.walletEdit,
208
- arguments: WalletEditPageArguments(
209
- walletListViewModel: widget.walletListViewModel,
210
- editingWallet: wallet,
211
- isWalletGroup: true,
212
- groupName: groupName,
213
- parentAddress: group.parentAddress,
214
- ),
215
- );
216
- },
217
- ),
218
- childWallets: group.wallets.map((walletInfo) {
219
- return widget.walletListViewModel.convertWalletInfoToWalletListItem(walletInfo);
220
- }).toList(),
221
- isSelected: false,
222
- onChildItemTapped: (wallet) =>
223
- wallet.isCurrent ? null : _loadWallet(wallet),
224
- childTrailingWidget: (item) {
225
- return item.isCurrent
226
- ? SizedBox.shrink()
227
- : Padding(
228
- padding: const EdgeInsets.only(right: 16),
229
- child: EditWalletButtonWidget(
230
- width: 44,
231
- onTap: () => Navigator.of(context).pushNamed(
232
- Routes.walletEdit,
233
- arguments: WalletEditPageArguments(
234
- walletListViewModel: widget.walletListViewModel,
235
- editingWallet: item,
236
- ),
236
+ ),
237
+ childWallets: group.wallets.map((walletInfo) {
238
+ return widget.walletListViewModel
239
+ .convertWalletInfoToWalletListItem(
240
+ walletInfo);
241
+ }).toList(),
242
+ isSelected: false,
243
+ onChildItemTapped: (wallet) =>
244
+ wallet.isCurrent ? null : _loadWallet(wallet),
245
+ childTrailingWidget: (item) {
246
+ return item.isCurrent
247
+ ? SizedBox.shrink()
248
+ : Padding(
249
+ padding: const EdgeInsets.only(right: 16),
250
+ child: EditWalletButtonWidget(
251
+ width: 44,
252
+ onTap: () =>
253
+ Navigator.of(context).pushNamed(
254
+ Routes.walletEdit,
255
+ arguments: WalletEditPageArguments(
256
+ walletListViewModel:
257
+ widget.walletListViewModel,
258
+ editingWallet: item,
259
),
260
),
239
- );
240
- },
241
- );
242
- },
243
- ),
261
+ ),
262
+ );
263
+ },
264
+ );
265
+ },
266
),
267
),
246
- SizedBox(height: 24),
247
- },
248
- if (widget.walletListViewModel.singleWalletsList.isNotEmpty) ...{
249
- Padding(
250
- padding: const EdgeInsets.only(left: 24),
251
- child: Text(
252
- S.current.single_seed_wallets_group,
253
- style: TextStyle(
254
- fontSize: 18,
255
- fontWeight: FontWeight.w500,
256
- color: Theme.of(context).extension<CakeTextTheme>()!.titleColor,
257
- ),
268
+ ),
269
+ SizedBox(height: 24),
270
+ },
271
+ if (widget
272
+ .walletListViewModel.singleWalletsList.isNotEmpty) ...{
273
+ Padding(
274
+ padding: const EdgeInsets.only(left: 24),
275
+ child: Text(
276
+ S.current.single_seed_wallets_group,
277
+ style: TextStyle(
278
+ fontSize: 18,
279
+ fontWeight: FontWeight.w500,
280
+ color: Theme.of(context)
281
+ .extension<CakeTextTheme>()!
282
+ .titleColor,
283
),
284
),
260
- SizedBox(height: 16),
261
- Container(
262
- child: Observer(
263
- builder: (_) => FilteredList(
264
- shrinkWrap: true,
265
- list: widget.walletListViewModel.singleWalletsList,
266
- updateFunction: widget.walletListViewModel.reorderAccordingToWalletList,
267
- itemBuilder: (context, index) {
268
- final wallet = widget.walletListViewModel.singleWalletsList[index];
269
- final currentColor = wallet.isCurrent
270
- ? Theme.of(context)
271
- .extension<WalletListTheme>()!
272
- .createNewWalletButtonBackgroundColor
273
- : Theme.of(context).colorScheme.background;
285
+ ),
286
+ SizedBox(height: 16),
287
+ Container(
288
+ child: Observer(
289
+ builder: (_) => FilteredList(
290
+ shrinkWrap: true,
291
+ list: widget.walletListViewModel.singleWalletsList,
292
+ updateFunction: widget
293
+ .walletListViewModel.reorderAccordingToWalletList,
294
+ itemBuilder: (context, index) {
295
+ final wallet = widget
296
+ .walletListViewModel.singleWalletsList[index];
297
+ final currentColor = wallet.isCurrent
298
+ ? Theme.of(context)
299
+ .extension<WalletListTheme>()!
300
+ .createNewWalletButtonBackgroundColor
301
+ : Theme.of(context).colorScheme.background;
302
275
- return GroupedWalletExpansionTile(
276
- tileKey: ValueKey('single_wallets_expansion_tile_widget_$index'),
277
- isCurrentlySelectedWallet: wallet.isCurrent,
278
- leadingWidget: SizedBox(
279
- width: wallet.isCurrent ? 56 : 40,
280
- child: Row(
281
- children: [
282
- wallet.isCurrent
283
- ? Container(
284
- height: 35,
285
- width: 6,
286
- margin: EdgeInsets.only(right: 16),
287
- decoration: BoxDecoration(
288
- borderRadius: BorderRadius.only(
289
- topRight: Radius.circular(16),
290
- bottomRight: Radius.circular(16),
291
- ),
292
- color: currentColor,
303
+ return GroupedWalletExpansionTile(
304
+ tileKey: ValueKey(
305
+ 'single_wallets_expansion_tile_widget_$index'),
306
+ isCurrentlySelectedWallet: wallet.isCurrent,
307
+ leadingWidget: SizedBox(
308
+ width: wallet.isCurrent ? 56 : 40,
309
+ child: Row(
310
+ children: [
311
+ wallet.isCurrent
312
+ ? Container(
313
+ height: 35,
314
+ width: 6,
315
+ margin: EdgeInsets.only(right: 16),
316
+ decoration: BoxDecoration(
317
+ borderRadius: BorderRadius.only(
318
+ topRight: Radius.circular(16),
319
+ bottomRight: Radius.circular(16),
320
),
294
- )
295
- : SizedBox(width: 6),
296
- Image.asset(
297
- walletTypeToCryptoCurrency(wallet.type).iconPath!,
298
- width: 32,
299
- height: 32,
300
- ),
301
- ],
302
- ),
303
- ),
304
- title: wallet.name,
305
- isSelected: false,
306
- borderRadius: BorderRadius.all(Radius.circular(16)),
307
- margin: EdgeInsets.only(left: 20, right: 20, bottom: 12),
308
- onTitleTapped: () => wallet.isCurrent ? null : _loadWallet(wallet),
309
- trailingWidget: wallet.isCurrent
310
- ? null
311
- : EditWalletButtonWidget(
312
- width: 44,
313
- onTap: () {
314
- Navigator.of(context).pushNamed(
315
- Routes.walletEdit,
316
- arguments: WalletEditPageArguments(
317
- walletListViewModel: widget.walletListViewModel,
318
- editingWallet: wallet,
321
+ color: currentColor,
322
),
320
- );
321
- },
322
- ),
323
- );
324
- },
325
- ),
323
+ )
324
+ : SizedBox(width: 6),
325
+ Image.asset(
326
+ walletTypeToCryptoCurrency(wallet.type)
327
+ .iconPath!,
328
+ width: 32,
329
+ height: 32,
330
+ ),
331
+ ],
332
+ ),
333
+ ),
334
+ title: wallet.name,
335
+ isSelected: false,
336
+ borderRadius: BorderRadius.all(Radius.circular(16)),
337
+ margin: EdgeInsets.only(
338
+ left: 20, right: 20, bottom: 12),
339
+ onTitleTapped: () =>
340
+ wallet.isCurrent ? null : _loadWallet(wallet),
341
+ trailingWidget: wallet.isCurrent
342
+ ? null
343
+ : EditWalletButtonWidget(
344
+ width: 44,
345
+ onTap: () {
346
+ Navigator.of(context).pushNamed(
347
+ Routes.walletEdit,
348
+ arguments: WalletEditPageArguments(
349
+ walletListViewModel:
350
+ widget.walletListViewModel,
351
+ editingWallet: wallet,
352
+ ),
353
+ );
354
+ },
355
+ ),
356
+ );
357
+ },
358
),
359
),
328
- },
329
- ],
330
- ),
360
+ ),
361
+ SizedBox(height: 150),
362
+ },
363
+ ],
364
),
365
),
333
- Padding(
334
- padding: const EdgeInsets.all(24),
335
- child: Column(
336
- children: <Widget>[
337
- PrimaryImageButton(
338
- key: ValueKey('wallet_list_page_restore_wallet_button_key'),
339
- onPressed: () {
340
- if (widget.walletListViewModel.shouldRequireTOTP2FAForCreatingNewWallets) {
341
- widget.authService.authenticateAction(
342
- context,
343
- route: Routes.restoreOptions,
344
- arguments: false,
345
- conditionToDetermineIfToUse2FA: widget.walletListViewModel.shouldRequireTOTP2FAForCreatingNewWallets,
346
- );
347
- } else {
348
- Navigator.of(context).pushNamed(Routes.restoreOptions, arguments: false);
349
- }
350
- },
351
- image: restoreWalletImage,
352
- text: S.of(context).wallet_list_restore_wallet,
353
- color: Theme.of(context).cardColor,
354
- textColor: Theme.of(context).extension<CakeTextTheme>()!.buttonTextColor,
366
+ Positioned(
367
+ bottom: 0.0,
368
+ child: Container(
369
+ //padding: EdgeInsets.only(top: 100),
370
+ alignment: Alignment.bottomCenter,
371
+ height: 185,
372
+ //width: 600,
373
+ //padding: EdgeInsets.only(top: 50),
374
+ decoration: BoxDecoration(
375
+ gradient: LinearGradient(
376
+ begin: Alignment.topCenter,
377
+ end: Alignment.bottomCenter,
378
+ colors: <Color>[
379
+ Theme.of(context).colorScheme.background.withAlpha(10),
380
+ Theme.of(context).colorScheme.background,
381
+ Theme.of(context).colorScheme.background,
382
+ Theme.of(context).colorScheme.background
383
+ ],
384
),
356
- SizedBox(height: 10.0),
357
- PrimaryImageButton(
358
- key: ValueKey('wallet_list_page_create_new_wallet_button_key'),
359
- onPressed: () {
360
- //TODO(David): Find a way to optimize this
361
- if (isSingleCoin) {
362
- if (widget.walletListViewModel.shouldRequireTOTP2FAForCreatingNewWallets) {
363
- widget.authService.authenticateAction(
364
- context,
365
- route: Routes.newWallet,
366
- arguments: NewWalletArguments(
367
- type: widget.walletListViewModel.currentWalletType,
368
- ),
369
- conditionToDetermineIfToUse2FA: widget.walletListViewModel.shouldRequireTOTP2FAForCreatingNewWallets,
370
- );
371
- } else {
372
- Navigator.of(context).pushNamed(
373
- Routes.newWallet,
374
- arguments: NewWalletArguments(
375
- type: widget.walletListViewModel.currentWalletType,
376
- ),
377
- );
378
- }
379
- } else {
380
- if (widget.walletListViewModel.shouldRequireTOTP2FAForCreatingNewWallets) {
381
- widget.authService.authenticateAction(
382
- context,
383
- route: Routes.newWalletType,
384
- conditionToDetermineIfToUse2FA: widget.walletListViewModel.shouldRequireTOTP2FAForCreatingNewWallets,
385
- );
386
- } else {
387
- Navigator.of(context).pushNamed(Routes.newWalletType);
388
- }
389
- }
390
- },
391
- image: newWalletImage,
392
- text: S.of(context).wallet_list_create_new_wallet,
393
- color: Theme.of(context).primaryColor,
394
- textColor: Colors.white,
385
+ ),
386
+ child: Container(
387
+ height: 120,
388
+ width: MediaQuery.of(context).size.width,
389
+ //alignment: Alignment.bottomCenter,
390
+ margin: EdgeInsets.only(bottom: 24),
391
+ padding: EdgeInsets.only(left: 16, right: 16),
392
+ child: Column(
393
+ mainAxisSize: MainAxisSize.min,
394
+ mainAxisAlignment: MainAxisAlignment.center,
395
+ crossAxisAlignment: CrossAxisAlignment.center,
396
+ children: <Widget>[
397
+ PrimaryImageButton(
398
+ key: ValueKey(
399
+ 'wallet_list_page_restore_wallet_button_key'),
400
+ onPressed: () {
401
+ if (widget.walletListViewModel
402
+ .shouldRequireTOTP2FAForCreatingNewWallets) {
403
+ widget.authService.authenticateAction(
404
+ context,
405
+ route: Routes.restoreOptions,
406
+ arguments: false,
407
+ conditionToDetermineIfToUse2FA: widget
408
+ .walletListViewModel
409
+ .shouldRequireTOTP2FAForCreatingNewWallets,
410
+ );
411
+ } else {
412
+ Navigator.of(context).pushNamed(Routes.restoreOptions,
413
+ arguments: false);
414
+ }
415
+ },
416
+ image: restoreWalletImage,
417
+ text: S.of(context).wallet_list_restore_wallet,
418
+ color: Theme.of(context).cardColor,
419
+ textColor: Theme.of(context)
420
+ .extension<CakeTextTheme>()!
421
+ .buttonTextColor,
422
+ ),
423
+ SizedBox(height: 10.0),
424
+ PrimaryImageButton(
425
+ key: ValueKey(
426
+ 'wallet_list_page_create_new_wallet_button_key'),
427
+ onPressed: () {
428
+ //TODO(David): Find a way to optimize this
429
+ if (isSingleCoin) {
430
+ if (widget.walletListViewModel
431
+ .shouldRequireTOTP2FAForCreatingNewWallets) {
432
+ widget.authService.authenticateAction(
433
+ context,
434
+ route: Routes.newWallet,
435
+ arguments: NewWalletArguments(
436
+ type: widget
437
+ .walletListViewModel.currentWalletType,
438
+ ),
439
+ conditionToDetermineIfToUse2FA: widget
440
+ .walletListViewModel
441
+ .shouldRequireTOTP2FAForCreatingNewWallets,
442
+ );
443
+ } else {
444
+ Navigator.of(context).pushNamed(
445
+ Routes.newWallet,
446
+ arguments: NewWalletArguments(
447
+ type: widget
448
+ .walletListViewModel.currentWalletType,
449
+ ),
450
+ );
451
+ }
452
+ } else {
453
+ if (widget.walletListViewModel
454
+ .shouldRequireTOTP2FAForCreatingNewWallets) {
455
+ widget.authService.authenticateAction(
456
+ context,
457
+ route: Routes.newWalletType,
458
+ conditionToDetermineIfToUse2FA: widget
459
+ .walletListViewModel
460
+ .shouldRequireTOTP2FAForCreatingNewWallets,
461
+ );
462
+ } else {
463
+ Navigator.of(context)
464
+ .pushNamed(Routes.newWalletType);
465
+ }
466
+ }
467
+ },
468
+ image: newWalletImage,
469
+ text: S.of(context).wallet_list_create_new_wallet,
470
+ color: Theme.of(context).primaryColor,
471
+ textColor: Colors.white,
472
+ ),
473
+ ],
474
),
396
- ],
475
+ ),
476
+ ),
477
),
398
- ),
478
],
479
),
480
+
481
);
482
}
483
485
if (SettingsStoreBase.walletPasswordDirectInput) {
486
Navigator.of(context).pushNamed(Routes.walletUnlockLoadable,
487
arguments: WalletUnlockArguments(
408
- callback: (bool isAuthenticatedSuccessfully, AuthPageState auth) async {
488
+ callback:
489
+ (bool isAuthenticatedSuccessfully, AuthPageState auth) async {
490
if (isAuthenticatedSuccessfully) {
491
auth.close();
492
setState(() {});