1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2024-11-22 12:59:21 +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/models/account_image_settings.dart';
import 'package:comunic/ui/widgets/async_screen_widget.dart'; import 'package:comunic/ui/widgets/async_screen_widget.dart';
import 'package:comunic/ui/widgets/network_image_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/account_utils.dart';
import 'package:comunic/utils/files_utils.dart'; import 'package:comunic/utils/files_utils.dart';
import 'package:comunic/utils/intl_utils.dart'; import 'package:comunic/utils/intl_utils.dart';
@ -50,6 +51,7 @@ class _AccountImageSettingsScreenState
Widget _buildLayout() { Widget _buildLayout() {
return SettingsList( return SettingsList(
sections: [ sections: [
HeadSpacerSection(),
SettingsSection( SettingsSection(
title: tr("General"), title: tr("General"),
tiles: _settings.hasImage tiles: _settings.hasImage

View File

@ -1,5 +1,6 @@
import 'package:comunic/helpers/account_helper.dart'; import 'package:comunic/helpers/account_helper.dart';
import 'package:comunic/ui/dialogs/input_user_password_dialog.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/intl_utils.dart';
import 'package:comunic/utils/ui_utils.dart'; import 'package:comunic/utils/ui_utils.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
@ -19,12 +20,13 @@ class _AccountPrivacySettingsState extends State<AccountPrivacySettings> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return SettingsList(sections: [ return SettingsList(sections: [
HeadSpacerSection(),
SettingsSection(title: tr("Privacy settings"), tiles: [ SettingsSection(title: tr("Privacy settings"), tiles: [
SettingsTile( SettingsTile(
title: tr("Delete your account"), title: tr("Delete your account"),
subtitle: subtitle:
tr("Permanently delete your account and all data related to it."), 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_new_password_dialog.dart';
import 'package:comunic/ui/dialogs/input_user_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/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/intl_utils.dart';
import 'package:comunic/utils/ui_utils.dart'; import 'package:comunic/utils/ui_utils.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -25,24 +26,25 @@ class _AccountSecuritySettingsScreenState
Widget build(BuildContext context) { Widget build(BuildContext context) {
return SettingsList( return SettingsList(
sections: [ sections: [
HeadSpacerSection(),
SettingsSection( SettingsSection(
title: tr("Password"), title: tr("Password"),
tiles: [ tiles: [
SettingsTile( SettingsTile(
title: tr("Change password"), title: tr("Change password"),
onPressed: (_) => _changePassword, onPressed: (_) => _changePassword(),
), ),
SettingsTile( SettingsTile(
title: tr("Change your security questions"), title: tr("Change your security questions"),
subtitle: tr( subtitle: tr(
"Your security questions can be used to recover an access to your account when you loose your password..."), "Your security questions can be used to recover an access to your account when you loose your password..."),
onPressed: (_) => _changeSecurityQuestions, onPressed: (_) => _changeSecurityQuestions(),
), ),
SettingsTile( SettingsTile(
title: tr("Disconnect all your devices"), title: tr("Disconnect all your devices"),
subtitle: tr( 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."), "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/application_settings.dart';
import 'package:comunic/ui/routes/settings/custom_emojies_account_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/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/intl_utils.dart';
import 'package:comunic/utils/ui_utils.dart'; import 'package:comunic/utils/ui_utils.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -145,6 +146,7 @@ class __AccountSettingsBodyState extends State<_AccountSettingsBody> {
/// Mobile mode /// Mobile mode
Widget _buildMobileMode() => SettingsList( Widget _buildMobileMode() => SettingsList(
sections: [ sections: [
HeadSpacerSection(),
SettingsSection( SettingsSection(
title: tr("Settings"), title: tr("Settings"),
tiles: _sections tiles: _sections

View File

@ -1,5 +1,6 @@
import 'package:comunic/helpers/preferences_helper.dart'; import 'package:comunic/helpers/preferences_helper.dart';
import 'package:comunic/ui/widgets/async_screen_widget.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/intl_utils.dart';
import 'package:comunic/utils/ui_utils.dart'; import 'package:comunic/utils/ui_utils.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -30,6 +31,7 @@ class _ApplicationSettingsState extends State<ApplicationSettings> {
Widget _buildSections() { Widget _buildSections() {
return SettingsList( return SettingsList(
sections: [ sections: [
HeadSpacerSection(),
_buildAppearanceSection(), _buildAppearanceSection(),
_buildGeneralSection(), _buildGeneralSection(),
_buildDebugSection() _buildDebugSection()
@ -67,7 +69,6 @@ class _ApplicationSettingsState extends State<ApplicationSettings> {
SettingsSection _buildDebugSection() => SettingsSection( SettingsSection _buildDebugSection() => SettingsSection(
title: tr("Debug features"), title: tr("Debug features"),
tiles: [ tiles: [
// Force mobile mode // Force mobile mode
_PreferencesSettingsTile( _PreferencesSettingsTile(
preferencesKey: PreferencesKeyList.FORCE_MOBILE_MODE, 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/multi_choices_dialog.dart';
import 'package:comunic/ui/dialogs/virtual_directory_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/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/multi_choices_settings_tile.dart';
import 'package:comunic/ui/widgets/settings/text_settings_edit_tile.dart'; import 'package:comunic/ui/widgets/settings/text_settings_edit_tile.dart';
import 'package:comunic/utils/account_utils.dart'; import 'package:comunic/utils/account_utils.dart';
@ -53,6 +54,7 @@ class _GeneralAccountSettingsScreenState
Widget _buildSettings() { Widget _buildSettings() {
return SettingsList( return SettingsList(
sections: [ sections: [
HeadSpacerSection(),
SettingsSection( SettingsSection(
title: tr("Main account information"), title: tr("Main account information"),
tiles: _mainInformationTiles(), 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( return SettingsTile(
title: title, title: title,
subtitle: currValue, subtitle: currValue,
onPressed: (_)=>readOnly ? null : () => _changeValue(context), onPressed: readOnly ? null : (_) => _changeValue(context),
); );
} }