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/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/app_settings_route.dart';
|
||||||
import 'package:comunic/ui/routes/conversation_route.dart';
|
import 'package:comunic/ui/routes/conversation_route.dart';
|
||||||
import 'package:comunic/ui/screens/conversations_list_screen.dart';
|
import 'package:comunic/ui/screens/conversations_list_screen.dart';
|
||||||
@ -116,6 +117,10 @@ class _HomeRouteState extends HomeController {
|
|||||||
_openAppSettings();
|
_openAppSettings();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case BarCallbackActions.OPEN_ACCOUNT_SETTINGS:
|
||||||
|
_openAccountsSettings();
|
||||||
|
break;
|
||||||
|
|
||||||
/// Show about dialog
|
/// Show about dialog
|
||||||
case BarCallbackActions.OPEN_ABOUT_DIALOG:
|
case BarCallbackActions.OPEN_ABOUT_DIALOG:
|
||||||
showAboutAppDialog(context);
|
showAboutAppDialog(context);
|
||||||
@ -218,6 +223,11 @@ class _HomeRouteState extends HomeController {
|
|||||||
.push(MaterialPageRoute(builder: (c) => AppSettingsRoute()));
|
.push(MaterialPageRoute(builder: (c) => AppSettingsRoute()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _openAccountsSettings() {
|
||||||
|
Navigator.of(context)
|
||||||
|
.push(MaterialPageRoute(builder: (c) => AccountSettingsRoute()));
|
||||||
|
}
|
||||||
|
|
||||||
/// Handle logout requests from user
|
/// Handle logout requests from user
|
||||||
Future<void> _logoutRequested() async {
|
Future<void> _logoutRequested() async {
|
||||||
if (!await showConfirmDialog(
|
if (!await showConfirmDialog(
|
||||||
|
@ -20,6 +20,7 @@ enum BarCallbackActions {
|
|||||||
OPEN_GROUP_PAGE,
|
OPEN_GROUP_PAGE,
|
||||||
OPEN_USER_PAGE,
|
OPEN_USER_PAGE,
|
||||||
OPEN_USER_ACCESS_DENIED_PAGE,
|
OPEN_USER_ACCESS_DENIED_PAGE,
|
||||||
|
OPEN_ACCOUNT_SETTINGS,
|
||||||
OPEN_APP_SETTINGS,
|
OPEN_APP_SETTINGS,
|
||||||
OPEN_USER_FRIENDS_LIST,
|
OPEN_USER_FRIENDS_LIST,
|
||||||
OPEN_ABOUT_DIALOG,
|
OPEN_ABOUT_DIALOG,
|
||||||
@ -90,6 +91,7 @@ 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("Groups"), action: BarCallbackActions.OPEN_GROUPS),
|
_ActionMenuItem(label: tr("Groups"), action: BarCallbackActions.OPEN_GROUPS),
|
||||||
|
_ActionMenuItem(label: tr("Account settings"), action: BarCallbackActions.OPEN_ACCOUNT_SETTINGS),
|
||||||
_ActionMenuItem(
|
_ActionMenuItem(
|
||||||
label: tr("App settings"), action: BarCallbackActions.OPEN_APP_SETTINGS),
|
label: tr("App settings"), action: BarCallbackActions.OPEN_APP_SETTINGS),
|
||||||
_ActionMenuItem(
|
_ActionMenuItem(
|
||||||
|
@ -233,6 +233,13 @@ packages:
|
|||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.5"
|
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:
|
shared_preferences:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
|
@ -54,6 +54,9 @@ dependencies:
|
|||||||
# Parse emojies
|
# Parse emojies
|
||||||
flutter_emoji: ^2.2.1+1
|
flutter_emoji: ^2.2.1+1
|
||||||
|
|
||||||
|
# Build settings UI
|
||||||
|
settings_ui: ^0.2.0
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
|
Loading…
Reference in New Issue
Block a user