1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2024-11-26 14:59:22 +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/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/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';
import 'package:comunic/utils/input_utils.dart'; import 'package:comunic/utils/input_utils.dart';
@ -141,25 +142,14 @@ class __GeneralAccountSettingsBodyState
List<SettingsTile> _pageSettingsTiles() { List<SettingsTile> _pageSettingsTiles() {
return [ return [
// Page visibility // Page visibility
SettingsTile( MultiChoicesSettingsTile(
title: tr("Page visibility"), title: tr("Page visibility"),
subtitle: _visibilityChoices
.firstWhere((f) => f.id == _settings.pageVisibility)
.subtitle,
onTap: () async {
final choice = await showMultiChoicesDialog(
context: context,
choices: _visibilityChoices, choices: _visibilityChoices,
defaultChoice: _settings.pageVisibility, currentValue: _settings.pageVisibility,
title: tr("Change your page visibility"), onChanged: (v) {
); _settings.pageVisibility = v;
if (choice == null) return;
_settings.pageVisibility = choice;
_updateSettings(); _updateSettings();
}, }),
),
// Allow comments on user page ? // Allow comments on user page ?
SettingsTile.switchTile( SettingsTile.switchTile(