From 8c547f293976bf860691ec2560f62f1a05df1f57 Mon Sep 17 00:00:00 2001 From: Fabian Freund Date: Tue, 23 Dec 2025 08:11:20 +0100 Subject: [PATCH] improve user ui; add quit button; --- .../presentation/dialogs/select_profile.dart | 48 +++++++++++++++++-- 1 file changed, 44 insertions(+), 4 deletions(-) diff --git a/app/lib/features/user/domain/presentation/dialogs/select_profile.dart b/app/lib/features/user/domain/presentation/dialogs/select_profile.dart index 8149d7a8..2802ea5b 100644 --- a/app/lib/features/user/domain/presentation/dialogs/select_profile.dart +++ b/app/lib/features/user/domain/presentation/dialogs/select_profile.dart @@ -19,6 +19,7 @@ */ import 'package:flutter/material.dart'; import 'package:flutter_hooks/flutter_hooks.dart'; +import 'package:flutter_material_design_icons/flutter_material_design_icons.dart'; import 'package:go_router/go_router.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart'; import 'package:weblibre/core/filesystem.dart'; @@ -33,7 +34,7 @@ class SelectProfileDialog extends HookConsumerWidget { final usersAsync = ref.watch(profileRepositoryProvider); return AlertDialog( - title: const Text('Manage Users'), + title: const Text('Users'), scrollable: true, content: usersAsync.when( skipLoadingOnReload: true, @@ -44,7 +45,7 @@ class SelectProfileDialog extends HookConsumerWidget { return ListTile( key: ValueKey(profile.id), enabled: !isSelected, - leading: const Icon(Icons.person), + trailing: !isSelected ? const Icon(MdiIcons.accountSwitch) : null, title: Text(profile.name), subtitle: isSelected ? const Text('Active') : null, onTap: () async { @@ -129,10 +130,49 @@ class SelectProfileDialog extends HookConsumerWidget { ), loading: () => const Center(child: CircularProgressIndicator()), ), + actionsAlignment: MainAxisAlignment.spaceBetween, actions: [ TextButton.icon( - icon: const Icon(Icons.edit), - label: const Text('Edit'), + icon: const Icon(MdiIcons.power), + iconAlignment: IconAlignment.start, + label: const Text('Quit Browser'), + onPressed: () async { + final result = await showDialog( + context: context, + builder: (BuildContext context) { + return AlertDialog( + icon: const Icon(Icons.warning), + title: const Text('Quit Browser'), + content: const Text( + 'This will properly shutdown the browser and clear private tabs', + ), + actions: [ + TextButton( + onPressed: () { + Navigator.pop(context, false); + }, + child: const Text('Cancel'), + ), + TextButton( + onPressed: () { + Navigator.pop(context, true); + }, + child: const Text('Quit'), + ), + ], + ); + }, + ); + + if (result == true) { + await exitApp(ref.container); + } + }, + ), + TextButton.icon( + icon: const Icon(MdiIcons.accountGroup), + iconAlignment: IconAlignment.end, + label: const Text('Manage'), onPressed: () async { await ProfileListRoute().push(context); },