diff --git a/lib/ui/routes/app_settings_route.dart b/lib/ui/routes/app_settings_route.dart new file mode 100644 index 0000000..455991c --- /dev/null +++ b/lib/ui/routes/app_settings_route.dart @@ -0,0 +1,31 @@ +import 'package:comunic/utils/intl_utils.dart'; +import 'package:flutter/material.dart'; + +/// Application settings route +/// +/// @author Pierre HUBERT + +class AppSettingsRoute extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text(tr("App settings")), + ), + body: _AppSettingsBody(), + ); + } +} + +class _AppSettingsBody extends StatefulWidget { + @override + __AppSettingsBodyState createState() => __AppSettingsBodyState(); +} + +class __AppSettingsBodyState extends State<_AppSettingsBody> { + @override + Widget build(BuildContext context) { + return ListView(children: [],); + } +} + diff --git a/lib/ui/routes/home_route.dart b/lib/ui/routes/home_route.dart index 96c6dac..1801670 100644 --- a/lib/ui/routes/home_route.dart +++ b/lib/ui/routes/home_route.dart @@ -1,4 +1,5 @@ import 'package:comunic/helpers/account_helper.dart'; +import 'package:comunic/ui/routes/app_settings_route.dart'; import 'package:comunic/ui/screens/conversations_list_screen.dart'; import 'package:comunic/ui/screens/friends_list_screen.dart'; import 'package:comunic/ui/screens/newest_posts.dart'; @@ -50,6 +51,11 @@ class _HomeRouteState extends State { _openCurrentUserPage(); break; + /// Open app settings page + case BarCallbackActions.OPEN_APP_SETTINGS: + _openAppSettings(); + break; + /// Logout user case BarCallbackActions.ACTION_LOGOUT: _logoutRequested(); @@ -111,6 +117,11 @@ class _HomeRouteState extends State { openUserPage(context: context, userID: userID()); } + void _openAppSettings() { + Navigator.of(context) + .push(MaterialPageRoute(builder: (c) => AppSettingsRoute())); + } + /// Handle logout requests from user Future _logoutRequested() async { if (!await showConfirmDialog( diff --git a/lib/ui/widgets/navbar_widget.dart b/lib/ui/widgets/navbar_widget.dart index 5d6e49f..3890eb7 100644 --- a/lib/ui/widgets/navbar_widget.dart +++ b/lib/ui/widgets/navbar_widget.dart @@ -13,6 +13,7 @@ enum BarCallbackActions { OPEN_NEWEST_POSTS, OPEN_FRIENDS, OPEN_MY_PAGE, + OPEN_APP_SETTINGS, NONE, ACTION_LOGOUT } @@ -27,12 +28,12 @@ class _MenuItem { final BarCallbackActions action; final bool isMenu; - const _MenuItem( - {@required this.label, - @required this.icon, - @required this.action, - this.isMenu = false}) - : assert(label != null), + const _MenuItem({ + @required this.label, + @required this.icon, + @required this.action, + this.isMenu = false, + }) : assert(label != null), assert(icon != null || isMenu), assert(action != null), assert(isMenu != null); @@ -73,6 +74,8 @@ final _menuItems = <_MenuItem>[ final _menuActionsItem = <_ActionMenuItem>[ _ActionMenuItem( label: tr("My Page"), action: BarCallbackActions.OPEN_MY_PAGE), + _ActionMenuItem( + label: tr("App settings"), action: BarCallbackActions.OPEN_APP_SETTINGS), _ActionMenuItem( label: tr("Sign out"), action: BarCallbackActions.ACTION_LOGOUT), ]; @@ -96,10 +99,10 @@ class ComunicAppBar extends StatelessWidget implements PreferredSizeWidget { children: List.generate( _menuItems.length, (i) => _MenuItemWidget( - item: _menuItems[i], - onTap: onTap, - isSelected: _menuItems[i].action == selectedAction, - ), + item: _menuItems[i], + onTap: onTap, + isSelected: _menuItems[i].action == selectedAction, + ), ), ), );