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

Simplify code

This commit is contained in:
Pierre HUBERT 2020-05-01 20:55:24 +02:00
parent 2d86780f0b
commit dbf2ed868a

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/multi_choices_settings_tile.dart';
import 'package:comunic/ui/widgets/settings/text_settings_edit_tile.dart';
import 'package:comunic/utils/account_utils.dart';
import 'package:comunic/utils/input_utils.dart';
@ -141,25 +142,14 @@ class __GeneralAccountSettingsBodyState
List<SettingsTile> _pageSettingsTiles() {
return [
// Page visibility
SettingsTile(
title: tr("Page visibility"),
subtitle: _visibilityChoices
.firstWhere((f) => f.id == _settings.pageVisibility)
.subtitle,
onTap: () async {
final choice = await showMultiChoicesDialog(
context: context,
choices: _visibilityChoices,
defaultChoice: _settings.pageVisibility,
title: tr("Change your page visibility"),
);
if (choice == null) return;
_settings.pageVisibility = choice;
_updateSettings();
},
),
MultiChoicesSettingsTile(
title: tr("Page visibility"),
choices: _visibilityChoices,
currentValue: _settings.pageVisibility,
onChanged: (v) {
_settings.pageVisibility = v;
_updateSettings();
}),
// Allow comments on user page ?
SettingsTile.switchTile(