Skip to content

Commit 23d2de2

Browse files
authored
Merge pull request #211 from cypherstack/desktop
Desktop
2 parents 4c8a335 + 2d9cf91 commit 23d2de2

File tree

8 files changed

+737
-130
lines changed

8 files changed

+737
-130
lines changed

lib/pages/settings_views/global_settings_view/stack_backup_views/restore_from_file_view.dart

Lines changed: 77 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import 'dart:async';
12
import 'dart:io';
23

34
import 'package:flutter/foundation.dart';
@@ -315,42 +316,45 @@ class _RestoreFromFileViewState extends ConsumerState<RestoreFromFileView> {
315316
}
316317

317318
bool shouldPop = false;
318-
await showDialog<dynamic>(
319-
barrierDismissible: false,
320-
context: context,
321-
builder: (_) => WillPopScope(
322-
onWillPop: () async {
323-
return shouldPop;
324-
},
325-
child: Column(
326-
crossAxisAlignment:
327-
CrossAxisAlignment.stretch,
328-
mainAxisAlignment: MainAxisAlignment.center,
329-
children: [
330-
Material(
331-
color: Colors.transparent,
332-
child: Center(
333-
child: Text(
334-
"Decrypting Stack backup file",
335-
style:
336-
STextStyles.pageTitleH2(context)
337-
.copyWith(
338-
color: Theme.of(context)
339-
.extension<StackColors>()!
340-
.textWhite,
319+
unawaited(
320+
showDialog<dynamic>(
321+
barrierDismissible: false,
322+
context: context,
323+
builder: (_) => WillPopScope(
324+
onWillPop: () async {
325+
return shouldPop;
326+
},
327+
child: Column(
328+
crossAxisAlignment:
329+
CrossAxisAlignment.stretch,
330+
mainAxisAlignment:
331+
MainAxisAlignment.center,
332+
children: [
333+
Material(
334+
color: Colors.transparent,
335+
child: Center(
336+
child: Text(
337+
"Decrypting Stack backup file",
338+
style: STextStyles.pageTitleH2(
339+
context)
340+
.copyWith(
341+
color: Theme.of(context)
342+
.extension<StackColors>()!
343+
.textWhite,
344+
),
341345
),
342346
),
343347
),
344-
),
345-
const SizedBox(
346-
height: 64,
347-
),
348-
const Center(
349-
child: LoadingIndicator(
350-
width: 100,
348+
const SizedBox(
349+
height: 64,
351350
),
352-
),
353-
],
351+
const Center(
352+
child: LoadingIndicator(
353+
width: 100,
354+
),
355+
),
356+
],
357+
),
354358
),
355359
),
356360
);
@@ -424,43 +428,47 @@ class _RestoreFromFileViewState extends ConsumerState<RestoreFromFileView> {
424428
}
425429

426430
bool shouldPop = false;
427-
await showDialog<dynamic>(
428-
barrierDismissible: false,
429-
context: context,
430-
builder: (_) => WillPopScope(
431-
onWillPop: () async {
432-
return shouldPop;
433-
},
434-
child: Column(
435-
crossAxisAlignment:
436-
CrossAxisAlignment.stretch,
437-
mainAxisAlignment:
438-
MainAxisAlignment.center,
439-
children: [
440-
Material(
441-
color: Colors.transparent,
442-
child: Center(
443-
child: Text(
444-
"Decrypting Stack backup file",
445-
style: STextStyles.pageTitleH2(
446-
context)
447-
.copyWith(
448-
color: Theme.of(context)
449-
.extension<StackColors>()!
450-
.textWhite,
431+
unawaited(
432+
showDialog<dynamic>(
433+
barrierDismissible: false,
434+
context: context,
435+
builder: (_) => WillPopScope(
436+
onWillPop: () async {
437+
return shouldPop;
438+
},
439+
child: Column(
440+
crossAxisAlignment:
441+
CrossAxisAlignment.stretch,
442+
mainAxisAlignment:
443+
MainAxisAlignment.center,
444+
children: [
445+
Material(
446+
color: Colors.transparent,
447+
child: Center(
448+
child: Text(
449+
"Decrypting Stack backup file",
450+
style:
451+
STextStyles.pageTitleH2(
452+
context)
453+
.copyWith(
454+
color: Theme.of(context)
455+
.extension<
456+
StackColors>()!
457+
.textWhite,
458+
),
451459
),
452460
),
453461
),
454-
),
455-
const SizedBox(
456-
height: 64,
457-
),
458-
const Center(
459-
child: LoadingIndicator(
460-
width: 100,
462+
const SizedBox(
463+
height: 64,
461464
),
462-
),
463-
],
465+
const Center(
466+
child: LoadingIndicator(
467+
width: 100,
468+
),
469+
),
470+
],
471+
),
464472
),
465473
),
466474
);
@@ -475,7 +483,10 @@ class _RestoreFromFileViewState extends ConsumerState<RestoreFromFileView> {
475483
if (mounted) {
476484
// pop LoadingIndicator
477485
shouldPop = true;
478-
Navigator.of(context).pop();
486+
Navigator.of(
487+
context,
488+
rootNavigator: true,
489+
).pop();
479490

480491
passwordController.text = "";
481492

Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
import 'package:flutter/material.dart';
2+
import 'package:flutter_riverpod/flutter_riverpod.dart';
3+
import 'package:flutter_svg/svg.dart';
4+
import 'package:stackwallet/providers/global/wallets_provider.dart';
5+
import 'package:stackwallet/utilities/assets.dart';
6+
import 'package:stackwallet/utilities/constants.dart';
7+
import 'package:stackwallet/utilities/text_styles.dart';
8+
import 'package:stackwallet/widgets/desktop/desktop_app_bar.dart';
9+
import 'package:stackwallet/widgets/icon_widgets/x_icon.dart';
10+
import 'package:stackwallet/widgets/stack_text_field.dart';
11+
import 'package:stackwallet/widgets/textfield_icon_button.dart';
12+
13+
class DesktopAddressBook extends ConsumerStatefulWidget {
14+
const DesktopAddressBook({Key? key}) : super(key: key);
15+
16+
static const String routeName = "/desktopAddressBook";
17+
18+
@override
19+
ConsumerState<DesktopAddressBook> createState() => _DesktopAddressBook();
20+
}
21+
22+
class _DesktopAddressBook extends ConsumerState<DesktopAddressBook> {
23+
late final TextEditingController _searchController;
24+
25+
late final FocusNode _searchFocusNode;
26+
27+
String filter = "";
28+
29+
@override
30+
void initState() {
31+
_searchController = TextEditingController();
32+
_searchFocusNode = FocusNode();
33+
34+
super.initState();
35+
}
36+
37+
@override
38+
void dispose() {
39+
_searchController.dispose();
40+
_searchFocusNode.dispose();
41+
42+
super.dispose();
43+
}
44+
45+
@override
46+
Widget build(BuildContext context) {
47+
debugPrint("BUILD: $runtimeType");
48+
final hasWallets = ref.watch(walletsChangeNotifierProvider).hasWallets;
49+
50+
return Column(
51+
mainAxisSize: MainAxisSize.min,
52+
children: [
53+
DesktopAppBar(
54+
isCompactHeight: true,
55+
leading: Row(
56+
children: [
57+
const SizedBox(
58+
width: 24,
59+
),
60+
Text(
61+
"Address Book",
62+
style: STextStyles.desktopH3(context),
63+
)
64+
],
65+
),
66+
),
67+
const SizedBox(height: 53),
68+
Padding(
69+
padding: const EdgeInsets.symmetric(horizontal: 24),
70+
child: Row(
71+
children: [
72+
SizedBox(
73+
height: 60,
74+
width: 489,
75+
child: ClipRRect(
76+
borderRadius: BorderRadius.circular(
77+
Constants.size.circularBorderRadius,
78+
),
79+
child: TextField(
80+
autocorrect: false,
81+
enableSuggestions: false,
82+
controller: _searchController,
83+
focusNode: _searchFocusNode,
84+
onChanged: (newString) {
85+
setState(() => filter = newString);
86+
},
87+
style: STextStyles.field(context),
88+
decoration: standardInputDecoration(
89+
"Search...",
90+
_searchFocusNode,
91+
context,
92+
).copyWith(
93+
labelStyle: STextStyles.fieldLabel(context)
94+
.copyWith(fontSize: 16),
95+
prefixIcon: Padding(
96+
padding: const EdgeInsets.symmetric(
97+
horizontal: 10,
98+
vertical: 16,
99+
),
100+
child: SvgPicture.asset(
101+
Assets.svg.search,
102+
width: 16,
103+
height: 16,
104+
),
105+
),
106+
suffixIcon: _searchController.text.isNotEmpty
107+
? Padding(
108+
padding: const EdgeInsets.only(right: 0),
109+
child: UnconstrainedBox(
110+
child: Row(
111+
children: [
112+
TextFieldIconButton(
113+
child: const XIcon(),
114+
onTap: () async {
115+
setState(() {
116+
_searchController.text = "";
117+
filter = "";
118+
});
119+
},
120+
),
121+
],
122+
),
123+
),
124+
)
125+
: null,
126+
),
127+
),
128+
),
129+
),
130+
],
131+
),
132+
),
133+
// Expanded(
134+
// child: hasWallets ? const MyWallets() : const EmptyWallets(),
135+
// ),
136+
],
137+
);
138+
}
139+
}

lib/pages_desktop_specific/home/desktop_home_view.dart

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import 'package:flutter/material.dart';
22
import 'package:flutter_riverpod/flutter_riverpod.dart';
3+
import 'package:stackwallet/pages_desktop_specific/home/address_book_view/desktop_address_book.dart';
34
import 'package:stackwallet/pages_desktop_specific/home/desktop_menu.dart';
45
import 'package:stackwallet/pages_desktop_specific/home/desktop_settings_view.dart';
56
import 'package:stackwallet/pages_desktop_specific/home/my_stack_view/my_stack_view.dart';
@@ -31,8 +32,10 @@ class _DesktopHomeViewState extends ConsumerState<DesktopHomeView> {
3132
Container(
3233
color: Colors.red,
3334
),
34-
Container(
35-
color: Colors.orange,
35+
const Navigator(
36+
key: Key("desktopAddressBookHomeKey"),
37+
onGenerateRoute: RouteGenerator.generateRoute,
38+
initialRoute: DesktopAddressBook.routeName,
3639
),
3740
const Navigator(
3841
key: Key("desktopSettingHomeKey"),

0 commit comments

Comments
 (0)