From 52cc8407d50d00afcc1ced1eda00f8ae27637368 Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Fri, 12 Feb 2021 22:36:22 +0100 Subject: [PATCH] Fix bugs in application settings --- lib/ui/routes/settings/account_image_settings.dart | 2 ++ lib/ui/routes/settings/account_privacy_settings.dart | 4 +++- lib/ui/routes/settings/account_security_settings.dart | 8 +++++--- lib/ui/routes/settings/account_settings_route.dart | 2 ++ lib/ui/routes/settings/application_settings.dart | 3 ++- lib/ui/routes/settings/general_account_settings.dart | 2 ++ lib/ui/widgets/settings/header_spacer_section.dart | 7 +++++++ lib/ui/widgets/settings/text_settings_edit_tile.dart | 2 +- 8 files changed, 24 insertions(+), 6 deletions(-) create mode 100644 lib/ui/widgets/settings/header_spacer_section.dart diff --git a/lib/ui/routes/settings/account_image_settings.dart b/lib/ui/routes/settings/account_image_settings.dart index bf2bff4..d891ed5 100644 --- a/lib/ui/routes/settings/account_image_settings.dart +++ b/lib/ui/routes/settings/account_image_settings.dart @@ -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 diff --git a/lib/ui/routes/settings/account_privacy_settings.dart b/lib/ui/routes/settings/account_privacy_settings.dart index 8ffbe49..8c771cb 100644 --- a/lib/ui/routes/settings/account_privacy_settings.dart +++ b/lib/ui/routes/settings/account_privacy_settings.dart @@ -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 { @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(), ) ]) ]); diff --git a/lib/ui/routes/settings/account_security_settings.dart b/lib/ui/routes/settings/account_security_settings.dart index 7f85074..0306234 100644 --- a/lib/ui/routes/settings/account_security_settings.dart +++ b/lib/ui/routes/settings/account_security_settings.dart @@ -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(), ), ], ) diff --git a/lib/ui/routes/settings/account_settings_route.dart b/lib/ui/routes/settings/account_settings_route.dart index c50cb68..2d2307d 100644 --- a/lib/ui/routes/settings/account_settings_route.dart +++ b/lib/ui/routes/settings/account_settings_route.dart @@ -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 diff --git a/lib/ui/routes/settings/application_settings.dart b/lib/ui/routes/settings/application_settings.dart index 97a23a5..fca3bdc 100644 --- a/lib/ui/routes/settings/application_settings.dart +++ b/lib/ui/routes/settings/application_settings.dart @@ -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 { Widget _buildSections() { return SettingsList( sections: [ + HeadSpacerSection(), _buildAppearanceSection(), _buildGeneralSection(), _buildDebugSection() @@ -67,7 +69,6 @@ class _ApplicationSettingsState extends State { SettingsSection _buildDebugSection() => SettingsSection( title: tr("Debug features"), tiles: [ - // Force mobile mode _PreferencesSettingsTile( preferencesKey: PreferencesKeyList.FORCE_MOBILE_MODE, diff --git a/lib/ui/routes/settings/general_account_settings.dart b/lib/ui/routes/settings/general_account_settings.dart index 8ac2e75..486371a 100644 --- a/lib/ui/routes/settings/general_account_settings.dart +++ b/lib/ui/routes/settings/general_account_settings.dart @@ -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(), diff --git a/lib/ui/widgets/settings/header_spacer_section.dart b/lib/ui/widgets/settings/header_spacer_section.dart new file mode 100644 index 0000000..b992a49 --- /dev/null +++ b/lib/ui/widgets/settings/header_spacer_section.dart @@ -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)); +} diff --git a/lib/ui/widgets/settings/text_settings_edit_tile.dart b/lib/ui/widgets/settings/text_settings_edit_tile.dart index c1a6238..e45ad2e 100644 --- a/lib/ui/widgets/settings/text_settings_edit_tile.dart +++ b/lib/ui/widgets/settings/text_settings_edit_tile.dart @@ -40,7 +40,7 @@ class TextEditSettingsTile extends SettingsTile { return SettingsTile( title: title, subtitle: currValue, - onPressed: (_)=>readOnly ? null : () => _changeValue(context), + onPressed: readOnly ? null : (_) => _changeValue(context), ); }