1
1
import 'package:flutter/material.dart' ;
2
2
import 'package:flutter_adaptive_scaffold/flutter_adaptive_scaffold.dart' ;
3
+ import 'package:flutter_bloc/flutter_bloc.dart' ;
3
4
import 'package:go_router/go_router.dart' ;
5
+ import 'package:ht_dashboard/app/bloc/app_bloc.dart' ;
4
6
import 'package:ht_dashboard/l10n/l10n.dart' ;
5
7
import 'package:ht_dashboard/router/routes.dart' ;
6
8
import 'package:ht_dashboard/shared/constants/app_spacing.dart' ;
@@ -34,10 +36,24 @@ class AppShell extends StatelessWidget {
34
36
appBar: AppBar (
35
37
title: Text (l10n.dashboard),
36
38
actions: [
37
- InkWell (
38
- onTap: () {
39
- context.goNamed (Routes .settingsName);
39
+ PopupMenuButton <String >(
40
+ onSelected: (value) {
41
+ if (value == 'settings' ) {
42
+ context.goNamed (Routes .settingsName);
43
+ } else if (value == 'signOut' ) {
44
+ context.read <AppBloc >().add (const AppLogoutRequested ());
45
+ }
40
46
},
47
+ itemBuilder: (BuildContext context) => < PopupMenuEntry <String >> [
48
+ PopupMenuItem <String >(
49
+ value: 'settings' ,
50
+ child: Text (l10n.settings),
51
+ ),
52
+ PopupMenuItem <String >(
53
+ value: 'signOut' ,
54
+ child: Text (l10n.signOut),
55
+ ),
56
+ ],
41
57
child: Padding (
42
58
padding: const EdgeInsets .all (AppSpacing .sm),
43
59
child: CircleAvatar (
@@ -49,7 +65,7 @@ class AppShell extends StatelessWidget {
49
65
),
50
66
),
51
67
),
52
- SizedBox (width: AppSpacing .sm),
68
+ const SizedBox (width: AppSpacing .sm),
53
69
],
54
70
),
55
71
body: AdaptiveScaffold (
0 commit comments