Skip to content

Commit 8148a99

Browse files
Merge pull request #78 from owlistic-notes/sidebar
Restore logout confirmation
2 parents 7af76ad + f0fcb78 commit 8148a99

File tree

8 files changed

+13
-23
lines changed

8 files changed

+13
-23
lines changed

src/frontend/lib/screens/home_screen.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ class _HomeScreenState extends State<HomeScreen> {
8888
ThemeSwitcher(), // Add theme switcher to app bar
8989
],
9090
),
91-
drawer: const AppDrawer(),
91+
drawer: const SidebarDrawer(),
9292
body: !_isInitialized
9393
? const Center(child: CircularProgressIndicator())
9494
: RefreshIndicator(

src/frontend/lib/screens/notebook_detail_screen.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ class _NotebookDetailScreenState extends State<NotebookDetailScreen> {
218218
}
219219
),
220220
),
221-
drawer: const AppDrawer(),
221+
drawer: const SidebarDrawer(),
222222
body: _isLoading
223223
? const Center(child: CircularProgressIndicator())
224224
: Consumer<NotebooksViewModel>(

src/frontend/lib/screens/notebooks_screen.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class _NotebooksScreenState extends State<NotebooksScreen> {
6161
onMenuPressed: () => _scaffoldKey.currentState?.openDrawer(),
6262
actions: const [ThemeSwitcher()],
6363
),
64-
drawer: const AppDrawer(),
64+
drawer: const SidebarDrawer(),
6565
body: Consumer<NotebooksViewModel>(
6666
builder: (context, viewModel, _) {
6767
return _buildContent(context, viewModel);

src/frontend/lib/screens/notes_screen.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -680,7 +680,7 @@ class _NotesScreenState extends State<NotesScreen> {
680680
onMenuPressed: () => _scaffoldKey.currentState?.openDrawer(),
681681
actions: const [ThemeSwitcher()],
682682
),
683-
drawer: const AppDrawer(),
683+
drawer: const SidebarDrawer(),
684684
body: Consumer<NotesViewModel>(
685685
builder: (context, notesViewModel, _) {
686686
return _buildBody(notesViewModel);

src/frontend/lib/screens/tasks_screen.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ class _TasksScreenState extends State<TasksScreen> {
236236
}
237237
},
238238
),
239-
drawer: const AppDrawer(),
239+
drawer: const SidebarDrawer(),
240240
body: Consumer<TasksViewModel>(
241241
builder: (ctx, tasksViewModel, _) {
242242
if (tasksViewModel.isLoading) {

src/frontend/lib/screens/trash_screen.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class _TrashScreenState extends State<TrashScreen> {
6161
showBackButton: false,
6262
actions: const [ThemeSwitcher()],
6363
),
64-
drawer: const AppDrawer(),
64+
drawer: const SidebarDrawer(),
6565
body: Consumer<TrashViewModel>(
6666
builder: (ctx, trashViewModel, _) {
6767
if (trashViewModel.isLoading) {

src/frontend/lib/screens/user_profile_screen.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ class _UserProfileScreenState extends State<UserProfileScreen> {
184184
onMenuPressed: () => _scaffoldKey.currentState?.openDrawer(),
185185
actions: const [ThemeSwitcher()],
186186
),
187-
drawer: const AppDrawer(),
187+
drawer: const SidebarDrawer(),
188188
body: Consumer<UserProfileViewModel>(
189189
builder: (context, viewModel, _) {
190190
if (viewModel.isLoadingProfile) {

src/frontend/lib/widgets/app_drawer.dart

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,14 @@ import 'package:owlistic/core/theme.dart';
55
import 'package:owlistic/viewmodel/home_viewmodel.dart';
66
import 'app_logo.dart';
77

8-
class AppDrawer extends StatelessWidget {
9-
const AppDrawer({Key? key}) : super(key: key);
8+
class SidebarDrawer extends StatelessWidget {
9+
const SidebarDrawer({Key? key}) : super(key: key);
1010

1111
@override
1212
Widget build(BuildContext context) {
1313
return Drawer(
1414
child: Column(
1515
children: [
16-
// Smaller drawer header with app logo - using transparent logo
1716
Container(
1817
padding: const EdgeInsets.symmetric(vertical: 16, horizontal: 16),
1918
decoration: BoxDecoration(
@@ -35,7 +34,6 @@ class AppDrawer extends StatelessWidget {
3534
],
3635
),
3736
),
38-
// Drawer items
3937
ListTile(
4038
leading: const Icon(Icons.home),
4139
title: const Text('Home'),
@@ -68,6 +66,7 @@ class AppDrawer extends StatelessWidget {
6866
GoRouter.of(context).go('/tasks');
6967
},
7068
),
69+
const Divider(height: 1),
7170
ListTile(
7271
leading: const Icon(Icons.delete),
7372
title: const Text('Trash'),
@@ -76,7 +75,6 @@ class AppDrawer extends StatelessWidget {
7675
GoRouter.of(context).go('/trash');
7776
},
7877
),
79-
const Divider(),
8078
ListTile(
8179
leading: const Icon(Icons.settings),
8280
title: const Text('Settings'),
@@ -86,16 +84,12 @@ class AppDrawer extends StatelessWidget {
8684
},
8785
),
8886
const Spacer(),
89-
// Compact logout section
90-
const Divider(height: 1),
9187
ListTile(
9288
visualDensity: VisualDensity.compact,
9389
leading: const Icon(Icons.logout),
9490
title: const Text('Logout'),
9591
onTap: () async {
96-
Navigator.pop(context);
97-
// Use HomeViewModel for logout
98-
await context.read<HomeViewModel>().logout();
92+
_showLogoutConfirmation(context);
9993
},
10094
),
10195
],
@@ -116,13 +110,9 @@ class AppDrawer extends StatelessWidget {
116110
),
117111
ElevatedButton(
118112
onPressed: () async {
119-
Navigator.pop(ctx); // Close dialog
120-
Navigator.pop(context); // Close drawer
121-
122-
// Use the HomeViewModel for logout
113+
Navigator.pop(ctx);
114+
Navigator.pop(context);
123115
await context.read<HomeViewModel>().logout();
124-
125-
// Navigation will be handled by GoRouter redirect
126116
},
127117
style: AppTheme.getDangerButtonStyle(),
128118
child: const Text('Logout'),

0 commit comments

Comments
 (0)