mirror of
https://gitlab.com/comunic/comunicmobile
synced 2024-11-22 12:59:21 +00:00
Create application preferences route
This commit is contained in:
parent
a998ce13a3
commit
c367939ab6
31
lib/ui/routes/app_settings_route.dart
Normal file
31
lib/ui/routes/app_settings_route.dart
Normal file
@ -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: <Widget>[],);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,4 +1,5 @@
|
|||||||
import 'package:comunic/helpers/account_helper.dart';
|
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/conversations_list_screen.dart';
|
||||||
import 'package:comunic/ui/screens/friends_list_screen.dart';
|
import 'package:comunic/ui/screens/friends_list_screen.dart';
|
||||||
import 'package:comunic/ui/screens/newest_posts.dart';
|
import 'package:comunic/ui/screens/newest_posts.dart';
|
||||||
@ -50,6 +51,11 @@ class _HomeRouteState extends State<HomeRoute> {
|
|||||||
_openCurrentUserPage();
|
_openCurrentUserPage();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
/// Open app settings page
|
||||||
|
case BarCallbackActions.OPEN_APP_SETTINGS:
|
||||||
|
_openAppSettings();
|
||||||
|
break;
|
||||||
|
|
||||||
/// Logout user
|
/// Logout user
|
||||||
case BarCallbackActions.ACTION_LOGOUT:
|
case BarCallbackActions.ACTION_LOGOUT:
|
||||||
_logoutRequested();
|
_logoutRequested();
|
||||||
@ -111,6 +117,11 @@ class _HomeRouteState extends State<HomeRoute> {
|
|||||||
openUserPage(context: context, userID: userID());
|
openUserPage(context: context, userID: userID());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _openAppSettings() {
|
||||||
|
Navigator.of(context)
|
||||||
|
.push(MaterialPageRoute(builder: (c) => AppSettingsRoute()));
|
||||||
|
}
|
||||||
|
|
||||||
/// Handle logout requests from user
|
/// Handle logout requests from user
|
||||||
Future<void> _logoutRequested() async {
|
Future<void> _logoutRequested() async {
|
||||||
if (!await showConfirmDialog(
|
if (!await showConfirmDialog(
|
||||||
|
@ -13,6 +13,7 @@ enum BarCallbackActions {
|
|||||||
OPEN_NEWEST_POSTS,
|
OPEN_NEWEST_POSTS,
|
||||||
OPEN_FRIENDS,
|
OPEN_FRIENDS,
|
||||||
OPEN_MY_PAGE,
|
OPEN_MY_PAGE,
|
||||||
|
OPEN_APP_SETTINGS,
|
||||||
NONE,
|
NONE,
|
||||||
ACTION_LOGOUT
|
ACTION_LOGOUT
|
||||||
}
|
}
|
||||||
@ -27,12 +28,12 @@ class _MenuItem {
|
|||||||
final BarCallbackActions action;
|
final BarCallbackActions action;
|
||||||
final bool isMenu;
|
final bool isMenu;
|
||||||
|
|
||||||
const _MenuItem(
|
const _MenuItem({
|
||||||
{@required this.label,
|
@required this.label,
|
||||||
@required this.icon,
|
@required this.icon,
|
||||||
@required this.action,
|
@required this.action,
|
||||||
this.isMenu = false})
|
this.isMenu = false,
|
||||||
: assert(label != null),
|
}) : assert(label != null),
|
||||||
assert(icon != null || isMenu),
|
assert(icon != null || isMenu),
|
||||||
assert(action != null),
|
assert(action != null),
|
||||||
assert(isMenu != null);
|
assert(isMenu != null);
|
||||||
@ -73,6 +74,8 @@ final _menuItems = <_MenuItem>[
|
|||||||
final _menuActionsItem = <_ActionMenuItem>[
|
final _menuActionsItem = <_ActionMenuItem>[
|
||||||
_ActionMenuItem(
|
_ActionMenuItem(
|
||||||
label: tr("My Page"), action: BarCallbackActions.OPEN_MY_PAGE),
|
label: tr("My Page"), action: BarCallbackActions.OPEN_MY_PAGE),
|
||||||
|
_ActionMenuItem(
|
||||||
|
label: tr("App settings"), action: BarCallbackActions.OPEN_APP_SETTINGS),
|
||||||
_ActionMenuItem(
|
_ActionMenuItem(
|
||||||
label: tr("Sign out"), action: BarCallbackActions.ACTION_LOGOUT),
|
label: tr("Sign out"), action: BarCallbackActions.ACTION_LOGOUT),
|
||||||
];
|
];
|
||||||
|
Loading…
Reference in New Issue
Block a user