1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2024-12-26 12:58:51 +00:00

Fix bugs in application settings

This commit is contained in:
Pierre HUBERT 2021-02-12 22:36:22 +01:00
parent 523f9fd0e3
commit 52cc8407d5
8 changed files with 24 additions and 6 deletions

View File

@ -3,6 +3,7 @@ import 'package:comunic/helpers/settings_helper.dart';
import 'package:comunic/models/account_image_settings.dart';
import 'package:comunic/ui/widgets/async_screen_widget.dart';
import 'package:comunic/ui/widgets/network_image_widget.dart';
import 'package:comunic/ui/widgets/settings/header_spacer_section.dart';
import 'package:comunic/utils/account_utils.dart';
import 'package:comunic/utils/files_utils.dart';
import 'package:comunic/utils/intl_utils.dart';
@ -50,6 +51,7 @@ class _AccountImageSettingsScreenState
Widget _buildLayout() {
return SettingsList(
sections: [
HeadSpacerSection(),
SettingsSection(
title: tr("General"),
tiles: _settings.hasImage

View File

@ -1,5 +1,6 @@
import 'package:comunic/helpers/account_helper.dart';
import 'package:comunic/ui/dialogs/input_user_password_dialog.dart';
import 'package:comunic/ui/widgets/settings/header_spacer_section.dart';
import 'package:comunic/utils/intl_utils.dart';
import 'package:comunic/utils/ui_utils.dart';
import 'package:flutter/cupertino.dart';
@ -19,12 +20,13 @@ class _AccountPrivacySettingsState extends State<AccountPrivacySettings> {
@override
Widget build(BuildContext context) {
return SettingsList(sections: [
HeadSpacerSection(),
SettingsSection(title: tr("Privacy settings"), tiles: [
SettingsTile(
title: tr("Delete your account"),
subtitle:
tr("Permanently delete your account and all data related to it."),
onPressed: (_)=>_deleteAccount,
onPressed: (_) => _deleteAccount(),
)
])
]);

View File

@ -4,6 +4,7 @@ import 'package:comunic/models/security_settings.dart';
import 'package:comunic/ui/dialogs/input_new_password_dialog.dart';
import 'package:comunic/ui/dialogs/input_user_password_dialog.dart';
import 'package:comunic/ui/widgets/dialogs/auto_sized_dialog_content_widget.dart';
import 'package:comunic/ui/widgets/settings/header_spacer_section.dart';
import 'package:comunic/utils/intl_utils.dart';
import 'package:comunic/utils/ui_utils.dart';
import 'package:flutter/material.dart';
@ -25,24 +26,25 @@ class _AccountSecuritySettingsScreenState
Widget build(BuildContext context) {
return SettingsList(
sections: [
HeadSpacerSection(),
SettingsSection(
title: tr("Password"),
tiles: [
SettingsTile(
title: tr("Change password"),
onPressed: (_) => _changePassword,
onPressed: (_) => _changePassword(),
),
SettingsTile(
title: tr("Change your security questions"),
subtitle: tr(
"Your security questions can be used to recover an access to your account when you loose your password..."),
onPressed: (_) => _changeSecurityQuestions,
onPressed: (_) => _changeSecurityQuestions(),
),
SettingsTile(
title: tr("Disconnect all your devices"),
subtitle: tr(
"Disconnect all your devices from Comunic, including the current one. Use this option if one of the device you use for Comunic was stolen."),
onPressed: (_) => _disconnectAllDevices,
onPressed: (_) => _disconnectAllDevices(),
),
],
)

View File

@ -4,6 +4,7 @@ import 'package:comunic/ui/routes/settings/account_security_settings.dart';
import 'package:comunic/ui/routes/settings/application_settings.dart';
import 'package:comunic/ui/routes/settings/custom_emojies_account_settings.dart';
import 'package:comunic/ui/routes/settings/general_account_settings.dart';
import 'package:comunic/ui/widgets/settings/header_spacer_section.dart';
import 'package:comunic/utils/intl_utils.dart';
import 'package:comunic/utils/ui_utils.dart';
import 'package:flutter/material.dart';
@ -145,6 +146,7 @@ class __AccountSettingsBodyState extends State<_AccountSettingsBody> {
/// Mobile mode
Widget _buildMobileMode() => SettingsList(
sections: [
HeadSpacerSection(),
SettingsSection(
title: tr("Settings"),
tiles: _sections

View File

@ -1,5 +1,6 @@
import 'package:comunic/helpers/preferences_helper.dart';
import 'package:comunic/ui/widgets/async_screen_widget.dart';
import 'package:comunic/ui/widgets/settings/header_spacer_section.dart';
import 'package:comunic/utils/intl_utils.dart';
import 'package:comunic/utils/ui_utils.dart';
import 'package:flutter/material.dart';
@ -30,6 +31,7 @@ class _ApplicationSettingsState extends State<ApplicationSettings> {
Widget _buildSections() {
return SettingsList(
sections: [
HeadSpacerSection(),
_buildAppearanceSection(),
_buildGeneralSection(),
_buildDebugSection()
@ -67,7 +69,6 @@ class _ApplicationSettingsState extends State<ApplicationSettings> {
SettingsSection _buildDebugSection() => SettingsSection(
title: tr("Debug features"),
tiles: [
// Force mobile mode
_PreferencesSettingsTile(
preferencesKey: PreferencesKeyList.FORCE_MOBILE_MODE,

View File

@ -5,6 +5,7 @@ import 'package:comunic/models/general_settings.dart';
import 'package:comunic/ui/dialogs/multi_choices_dialog.dart';
import 'package:comunic/ui/dialogs/virtual_directory_dialog.dart';
import 'package:comunic/ui/widgets/async_screen_widget.dart';
import 'package:comunic/ui/widgets/settings/header_spacer_section.dart';
import 'package:comunic/ui/widgets/settings/multi_choices_settings_tile.dart';
import 'package:comunic/ui/widgets/settings/text_settings_edit_tile.dart';
import 'package:comunic/utils/account_utils.dart';
@ -53,6 +54,7 @@ class _GeneralAccountSettingsScreenState
Widget _buildSettings() {
return SettingsList(
sections: [
HeadSpacerSection(),
SettingsSection(
title: tr("Main account information"),
tiles: _mainInformationTiles(),

View File

@ -0,0 +1,7 @@
import 'package:flutter/material.dart';
import 'package:settings_ui/settings_ui.dart';
// ignore: must_be_immutable
class HeadSpacerSection extends CustomSection {
HeadSpacerSection() : super(child: Container(height: 10));
}

View File

@ -40,7 +40,7 @@ class TextEditSettingsTile extends SettingsTile {
return SettingsTile(
title: title,
subtitle: currValue,
onPressed: (_)=>readOnly ? null : () => _changeValue(context),
onPressed: readOnly ? null : (_) => _changeValue(context),
);
}