From 88c3e837ab7c95382479e2cf05f46be9a6aab554 Mon Sep 17 00:00:00 2001 From: ggurdin Date: Wed, 16 Oct 2024 16:06:03 -0400 Subject: [PATCH] hide learning settings that aren't used often --- lib/pangea/models/space_model.dart | 12 ++++++ .../settings_learning_view.dart | 40 +++++++------------ 2 files changed, 27 insertions(+), 25 deletions(-) diff --git a/lib/pangea/models/space_model.dart b/lib/pangea/models/space_model.dart index 232899bb8..402ba0a14 100644 --- a/lib/pangea/models/space_model.dart +++ b/lib/pangea/models/space_model.dart @@ -269,4 +269,16 @@ extension SettingCopy on ToolSetting { return L10n.of(context)!.autoIGCToolDescription; } } + + bool get isAvailableSetting { + switch (this) { + case ToolSetting.interactiveTranslator: + case ToolSetting.interactiveGrammar: + case ToolSetting.definitions: + return false; + case ToolSetting.immersionMode: + case ToolSetting.autoIGC: + return true; + } + } } diff --git a/lib/pangea/pages/settings_learning/settings_learning_view.dart b/lib/pangea/pages/settings_learning/settings_learning_view.dart index 1a6576770..8a8f6da25 100644 --- a/lib/pangea/pages/settings_learning/settings_learning_view.dart +++ b/lib/pangea/pages/settings_learning/settings_learning_view.dart @@ -28,22 +28,12 @@ class SettingsLearningView extends StatelessWidget { children: [ LanguageTile(controller), CountryPickerTile(controller), - const SizedBox(height: 8), const Divider(height: 1), - const SizedBox(height: 8), - // if (controller.pangeaController.permissionsController.isUser18()) - // SwitchListTile.adaptive( - // activeColor: AppConfig.activeToggleColor, - // title: Text(L10n.of(context)!.publicProfileTitle), - // subtitle: Text(L10n.of(context)!.publicProfileDesc), - // value: controller.pangeaController.userController.isPublic, - // onChanged: (bool isPublicProfile) => - // controller.setPublicProfile(isPublicProfile), - // ), ListTile( - subtitle: Text(L10n.of(context)!.toggleToolSettingsDescription), + title: Text(L10n.of(context)!.toggleToolSettingsDescription), ), - for (final toolSetting in ToolSetting.values) + for (final toolSetting in ToolSetting.values + .where((tool) => tool.isAvailableSetting)) ProfileSettingsSwitchListTile.adaptive( defaultValue: controller.getToolSetting(toolSetting), title: toolSetting.toolName(context), @@ -66,18 +56,18 @@ class SettingsLearningView extends StatelessWidget { return profile; }), ), - ProfileSettingsSwitchListTile.adaptive( - defaultValue: controller.pangeaController.userController.profile - .userSettings.autoPlayMessages, - title: L10n.of(context)!.autoPlayTitle, - subtitle: L10n.of(context)!.autoPlayDesc, - onChange: (bool value) => controller - .pangeaController.userController - .updateProfile((profile) { - profile.userSettings.autoPlayMessages = value; - return profile; - }), - ), + // ProfileSettingsSwitchListTile.adaptive( + // defaultValue: controller.pangeaController.userController.profile + // .userSettings.autoPlayMessages, + // title: L10n.of(context)!.autoPlayTitle, + // subtitle: L10n.of(context)!.autoPlayDesc, + // onChange: (bool value) => controller + // .pangeaController.userController + // .updateProfile((profile) { + // profile.userSettings.autoPlayMessages = value; + // return profile; + // }), + // ), ], ), ),