mirror of
https://gitlab.com/comunic/comunicmobile
synced 2024-11-22 12:59:21 +00:00
Ready to implement account settings
This commit is contained in:
parent
806c6fbc2b
commit
7071600c3f
31
lib/ui/routes/account_settings/account_image_settings.dart
Normal file
31
lib/ui/routes/account_settings/account_image_settings.dart
Normal file
@ -0,0 +1,31 @@
|
||||
import 'package:comunic/utils/intl_utils.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
/// Account image settings section
|
||||
///
|
||||
/// @author Pierre Hubert
|
||||
|
||||
class AccountImageSettings extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text(tr("Account image settings")),
|
||||
),
|
||||
body: _AccountImageSettingsBody(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class _AccountImageSettingsBody extends StatefulWidget {
|
||||
@override
|
||||
__AccountImageSettingsBodyState createState() => __AccountImageSettingsBodyState();
|
||||
}
|
||||
|
||||
class __AccountImageSettingsBodyState extends State<_AccountImageSettingsBody> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container();
|
||||
}
|
||||
}
|
51
lib/ui/routes/account_settings/account_settings_route.dart
Normal file
51
lib/ui/routes/account_settings/account_settings_route.dart
Normal file
@ -0,0 +1,51 @@
|
||||
import 'package:comunic/ui/routes/account_settings/account_image_settings.dart';
|
||||
import 'package:comunic/utils/intl_utils.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:settings_ui/settings_ui.dart';
|
||||
|
||||
/// Account settings route
|
||||
///
|
||||
/// @author Pierre HUBERT
|
||||
|
||||
class AccountSettingsRoute extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text(tr("Account settings")),
|
||||
),
|
||||
body: _AccountSettingsBody(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _AccountSettingsBody extends StatefulWidget {
|
||||
@override
|
||||
__AccountSettingsBodyState createState() => __AccountSettingsBodyState();
|
||||
}
|
||||
|
||||
class __AccountSettingsBodyState extends State<_AccountSettingsBody> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SettingsList(
|
||||
sections: [
|
||||
SettingsSection(
|
||||
title: tr("Account settings"),
|
||||
tiles: [
|
||||
SettingsTile(
|
||||
title: tr("Account image"),
|
||||
subtitle: tr("Customize your account image"),
|
||||
leading: Icon(Icons.account_circle),
|
||||
onTap: () => _openSection(AccountImageSettings()),
|
||||
)
|
||||
],
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
/// Open a settings setings
|
||||
void _openSection(Widget w) {
|
||||
Navigator.of(context).push(MaterialPageRoute(builder: (c) => w));
|
||||
}
|
||||
}
|
@ -1,4 +1,5 @@
|
||||
import 'package:comunic/helpers/account_helper.dart';
|
||||
import 'package:comunic/ui/routes/account_settings/account_settings_route.dart';
|
||||
import 'package:comunic/ui/routes/app_settings_route.dart';
|
||||
import 'package:comunic/ui/routes/conversation_route.dart';
|
||||
import 'package:comunic/ui/screens/conversations_list_screen.dart';
|
||||
@ -116,6 +117,10 @@ class _HomeRouteState extends HomeController {
|
||||
_openAppSettings();
|
||||
break;
|
||||
|
||||
case BarCallbackActions.OPEN_ACCOUNT_SETTINGS:
|
||||
_openAccountsSettings();
|
||||
break;
|
||||
|
||||
/// Show about dialog
|
||||
case BarCallbackActions.OPEN_ABOUT_DIALOG:
|
||||
showAboutAppDialog(context);
|
||||
@ -218,6 +223,11 @@ class _HomeRouteState extends HomeController {
|
||||
.push(MaterialPageRoute(builder: (c) => AppSettingsRoute()));
|
||||
}
|
||||
|
||||
void _openAccountsSettings() {
|
||||
Navigator.of(context)
|
||||
.push(MaterialPageRoute(builder: (c) => AccountSettingsRoute()));
|
||||
}
|
||||
|
||||
/// Handle logout requests from user
|
||||
Future<void> _logoutRequested() async {
|
||||
if (!await showConfirmDialog(
|
||||
|
@ -20,6 +20,7 @@ enum BarCallbackActions {
|
||||
OPEN_GROUP_PAGE,
|
||||
OPEN_USER_PAGE,
|
||||
OPEN_USER_ACCESS_DENIED_PAGE,
|
||||
OPEN_ACCOUNT_SETTINGS,
|
||||
OPEN_APP_SETTINGS,
|
||||
OPEN_USER_FRIENDS_LIST,
|
||||
OPEN_ABOUT_DIALOG,
|
||||
@ -90,6 +91,7 @@ final _menuActionsItem = <_ActionMenuItem>[
|
||||
_ActionMenuItem(
|
||||
label: tr("My Page"), action: BarCallbackActions.OPEN_MY_PAGE),
|
||||
_ActionMenuItem(label: tr("Groups"), action: BarCallbackActions.OPEN_GROUPS),
|
||||
_ActionMenuItem(label: tr("Account settings"), action: BarCallbackActions.OPEN_ACCOUNT_SETTINGS),
|
||||
_ActionMenuItem(
|
||||
label: tr("App settings"), action: BarCallbackActions.OPEN_APP_SETTINGS),
|
||||
_ActionMenuItem(
|
||||
|
@ -233,6 +233,13 @@ packages:
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.0.5"
|
||||
settings_ui:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: settings_ui
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.2.0"
|
||||
shared_preferences:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
@ -54,6 +54,9 @@ dependencies:
|
||||
# Parse emojies
|
||||
flutter_emoji: ^2.2.1+1
|
||||
|
||||
# Build settings UI
|
||||
settings_ui: ^0.2.0
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
sdk: flutter
|
||||
|
Loading…
Reference in New Issue
Block a user