Skip to content

Commit 8c547f2

Browse files
committed
improve user ui; add quit button;
1 parent bf0906b commit 8c547f2

File tree

1 file changed

+44
-4
lines changed

1 file changed

+44
-4
lines changed

app/lib/features/user/domain/presentation/dialogs/select_profile.dart

Lines changed: 44 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
*/
2020
import 'package:flutter/material.dart';
2121
import 'package:flutter_hooks/flutter_hooks.dart';
22+
import 'package:flutter_material_design_icons/flutter_material_design_icons.dart';
2223
import 'package:go_router/go_router.dart';
2324
import 'package:hooks_riverpod/hooks_riverpod.dart';
2425
import 'package:weblibre/core/filesystem.dart';
@@ -33,7 +34,7 @@ class SelectProfileDialog extends HookConsumerWidget {
3334
final usersAsync = ref.watch(profileRepositoryProvider);
3435

3536
return AlertDialog(
36-
title: const Text('Manage Users'),
37+
title: const Text('Users'),
3738
scrollable: true,
3839
content: usersAsync.when(
3940
skipLoadingOnReload: true,
@@ -44,7 +45,7 @@ class SelectProfileDialog extends HookConsumerWidget {
4445
return ListTile(
4546
key: ValueKey(profile.id),
4647
enabled: !isSelected,
47-
leading: const Icon(Icons.person),
48+
trailing: !isSelected ? const Icon(MdiIcons.accountSwitch) : null,
4849
title: Text(profile.name),
4950
subtitle: isSelected ? const Text('Active') : null,
5051
onTap: () async {
@@ -129,10 +130,49 @@ class SelectProfileDialog extends HookConsumerWidget {
129130
),
130131
loading: () => const Center(child: CircularProgressIndicator()),
131132
),
133+
actionsAlignment: MainAxisAlignment.spaceBetween,
132134
actions: [
133135
TextButton.icon(
134-
icon: const Icon(Icons.edit),
135-
label: const Text('Edit'),
136+
icon: const Icon(MdiIcons.power),
137+
iconAlignment: IconAlignment.start,
138+
label: const Text('Quit Browser'),
139+
onPressed: () async {
140+
final result = await showDialog<bool?>(
141+
context: context,
142+
builder: (BuildContext context) {
143+
return AlertDialog(
144+
icon: const Icon(Icons.warning),
145+
title: const Text('Quit Browser'),
146+
content: const Text(
147+
'This will properly shutdown the browser and clear private tabs',
148+
),
149+
actions: <Widget>[
150+
TextButton(
151+
onPressed: () {
152+
Navigator.pop(context, false);
153+
},
154+
child: const Text('Cancel'),
155+
),
156+
TextButton(
157+
onPressed: () {
158+
Navigator.pop(context, true);
159+
},
160+
child: const Text('Quit'),
161+
),
162+
],
163+
);
164+
},
165+
);
166+
167+
if (result == true) {
168+
await exitApp(ref.container);
169+
}
170+
},
171+
),
172+
TextButton.icon(
173+
icon: const Icon(MdiIcons.accountGroup),
174+
iconAlignment: IconAlignment.end,
175+
label: const Text('Manage'),
136176
onPressed: () async {
137177
await ProfileListRoute().push(context);
138178
},

0 commit comments

Comments
 (0)