mirror of
https://gitlab.com/comunic/comunicmobile
synced 2025-06-19 08:15:16 +00:00
Ready to implement account settings
This commit is contained in:
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(
|
||||
|
Reference in New Issue
Block a user