diff --git a/packages/app/integration_test/screenshot_test.dart b/packages/app/integration_test/screenshot_test.dart index 5b9c4647..50973fea 100644 --- a/packages/app/integration_test/screenshot_test.dart +++ b/packages/app/integration_test/screenshot_test.dart @@ -346,7 +346,7 @@ Future main() async { await binding.takeScreenshot('settings_dark'); // Enable OLED theme - await tester.tap(find.byType(CheckboxListTile).first); + await tester.tap(find.byType(SwitchListTile).first); await tester.pumpAndSettle(); await binding.takeScreenshot('settings_oled'); diff --git a/packages/neon/neon/lib/src/pages/account_settings.dart b/packages/neon/neon/lib/src/pages/account_settings.dart index 15771698..f6bbf4d8 100644 --- a/packages/neon/neon/lib/src/pages/account_settings.dart +++ b/packages/neon/neon/lib/src/pages/account_settings.dart @@ -8,7 +8,7 @@ import 'package:neon/src/blocs/accounts.dart'; import 'package:neon/src/models/account.dart'; import 'package:neon/src/router.dart'; import 'package:neon/src/settings/widgets/custom_settings_tile.dart'; -import 'package:neon/src/settings/widgets/dropdown_button_settings_tile.dart'; +import 'package:neon/src/settings/widgets/select_settings_tile.dart'; import 'package:neon/src/settings/widgets/settings_category.dart'; import 'package:neon/src/settings/widgets/settings_list.dart'; import 'package:neon/src/theme/dialog.dart'; @@ -119,7 +119,7 @@ class AccountSettingsPage extends StatelessWidget { SettingsCategory( title: Text(AppLocalizations.of(context).optionsCategoryGeneral), tiles: [ - DropdownButtonSettingsTile( + SelectSettingsTile( option: options.initialApp, ), ], diff --git a/packages/neon/neon/lib/src/pages/settings.dart b/packages/neon/neon/lib/src/pages/settings.dart index 660456bd..518e21c0 100644 --- a/packages/neon/neon/lib/src/pages/settings.dart +++ b/packages/neon/neon/lib/src/pages/settings.dart @@ -10,13 +10,13 @@ import 'package:neon/src/platform/platform.dart'; import 'package:neon/src/router.dart'; import 'package:neon/src/settings/utils/settings_export_helper.dart'; import 'package:neon/src/settings/widgets/account_settings_tile.dart'; -import 'package:neon/src/settings/widgets/checkbox_settings_tile.dart'; import 'package:neon/src/settings/widgets/custom_settings_tile.dart'; -import 'package:neon/src/settings/widgets/dropdown_button_settings_tile.dart'; +import 'package:neon/src/settings/widgets/select_settings_tile.dart'; import 'package:neon/src/settings/widgets/settings_category.dart'; import 'package:neon/src/settings/widgets/settings_list.dart'; import 'package:neon/src/settings/widgets/settings_tile.dart'; import 'package:neon/src/settings/widgets/text_settings_tile.dart'; +import 'package:neon/src/settings/widgets/toggle_settings_tile.dart'; import 'package:neon/src/theme/branding.dart'; import 'package:neon/src/theme/dialog.dart'; import 'package:neon/src/utils/confirmation_dialog.dart'; @@ -120,13 +120,13 @@ class _SettingsPageState extends State { title: Text(AppLocalizations.of(context).optionsCategoryTheme), key: ValueKey(SettingsCategories.theme.name), tiles: [ - DropdownButtonSettingsTile( + SelectSettingsTile( option: globalOptions.themeMode, ), - CheckBoxSettingsTile( + ToggleSettingsTile( option: globalOptions.themeOLEDAsDark, ), - CheckBoxSettingsTile( + ToggleSettingsTile( option: globalOptions.themeKeepOriginalAccentColor, ), ], @@ -135,7 +135,7 @@ class _SettingsPageState extends State { title: Text(AppLocalizations.of(context).optionsCategoryNavigation), key: ValueKey(SettingsCategories.navigation.name), tiles: [ - DropdownButtonSettingsTile( + SelectSettingsTile( option: globalOptions.navigationMode, ), ], @@ -155,10 +155,10 @@ class _SettingsPageState extends State { ), ), ], - CheckBoxSettingsTile( + ToggleSettingsTile( option: globalOptions.pushNotificationsEnabled, ), - DropdownButtonSettingsTile( + SelectSettingsTile( option: globalOptions.pushNotificationsDistributor, ), ], @@ -169,10 +169,10 @@ class _SettingsPageState extends State { title: Text(AppLocalizations.of(context).optionsCategoryStartup), key: ValueKey(SettingsCategories.startup.name), tiles: [ - CheckBoxSettingsTile( + ToggleSettingsTile( option: globalOptions.startupMinimized, ), - CheckBoxSettingsTile( + ToggleSettingsTile( option: globalOptions.startupMinimizeInsteadOfExit, ), ], @@ -183,10 +183,10 @@ class _SettingsPageState extends State { title: Text(AppLocalizations.of(context).optionsCategorySystemTray), key: ValueKey(SettingsCategories.systemTray.name), tiles: [ - CheckBoxSettingsTile( + ToggleSettingsTile( option: globalOptions.systemTrayEnabled, ), - CheckBoxSettingsTile( + ToggleSettingsTile( option: globalOptions.systemTrayHideToTrayWhenMinimized, ), ], @@ -197,10 +197,10 @@ class _SettingsPageState extends State { key: ValueKey(SettingsCategories.accounts.name), tiles: [ if (accountsSnapshot.requireData.length > 1) ...[ - CheckBoxSettingsTile( + ToggleSettingsTile( option: globalOptions.rememberLastUsedAccount, ), - DropdownButtonSettingsTile( + SelectSettingsTile( option: globalOptions.initialAccount, ), ], diff --git a/packages/neon/neon/lib/src/settings/widgets/option_settings_tile.dart b/packages/neon/neon/lib/src/settings/widgets/option_settings_tile.dart index 8757c630..fc329a46 100644 --- a/packages/neon/neon/lib/src/settings/widgets/option_settings_tile.dart +++ b/packages/neon/neon/lib/src/settings/widgets/option_settings_tile.dart @@ -1,9 +1,9 @@ import 'package:flutter/widgets.dart'; import 'package:meta/meta.dart'; import 'package:neon/settings.dart'; -import 'package:neon/src/settings/widgets/checkbox_settings_tile.dart'; -import 'package:neon/src/settings/widgets/dropdown_button_settings_tile.dart'; +import 'package:neon/src/settings/widgets/select_settings_tile.dart'; import 'package:neon/src/settings/widgets/settings_tile.dart'; +import 'package:neon/src/settings/widgets/toggle_settings_tile.dart'; @internal class OptionSettingsTile extends InputSettingsTile { @@ -14,7 +14,7 @@ class OptionSettingsTile extends InputSettingsTile { @override Widget build(final BuildContext context) => switch (option) { - ToggleOption() => CheckBoxSettingsTile(option: option as ToggleOption), - SelectOption() => DropdownButtonSettingsTile(option: option as SelectOption), + ToggleOption() => ToggleSettingsTile(option: option as ToggleOption), + SelectOption() => SelectSettingsTile(option: option as SelectOption), }; } diff --git a/packages/neon/neon/lib/src/settings/widgets/dropdown_button_settings_tile.dart b/packages/neon/neon/lib/src/settings/widgets/select_settings_tile.dart similarity index 93% rename from packages/neon/neon/lib/src/settings/widgets/dropdown_button_settings_tile.dart rename to packages/neon/neon/lib/src/settings/widgets/select_settings_tile.dart index 5df717cf..3b06eb19 100644 --- a/packages/neon/neon/lib/src/settings/widgets/dropdown_button_settings_tile.dart +++ b/packages/neon/neon/lib/src/settings/widgets/select_settings_tile.dart @@ -4,8 +4,8 @@ import 'package:neon/src/settings/models/option.dart'; import 'package:neon/src/settings/widgets/settings_tile.dart'; @internal -class DropdownButtonSettingsTile extends InputSettingsTile> { - const DropdownButtonSettingsTile({ +class SelectSettingsTile extends InputSettingsTile> { + const SelectSettingsTile({ required super.option, super.key, }); diff --git a/packages/neon/neon/lib/src/settings/widgets/checkbox_settings_tile.dart b/packages/neon/neon/lib/src/settings/widgets/toggle_settings_tile.dart similarity index 60% rename from packages/neon/neon/lib/src/settings/widgets/checkbox_settings_tile.dart rename to packages/neon/neon/lib/src/settings/widgets/toggle_settings_tile.dart index e868a3ab..d334c599 100644 --- a/packages/neon/neon/lib/src/settings/widgets/checkbox_settings_tile.dart +++ b/packages/neon/neon/lib/src/settings/widgets/toggle_settings_tile.dart @@ -4,8 +4,8 @@ import 'package:neon/src/settings/models/option.dart'; import 'package:neon/src/settings/widgets/settings_tile.dart'; @internal -class CheckBoxSettingsTile extends InputSettingsTile { - const CheckBoxSettingsTile({ +class ToggleSettingsTile extends InputSettingsTile { + const ToggleSettingsTile({ required super.option, super.key, }); @@ -13,13 +13,10 @@ class CheckBoxSettingsTile extends InputSettingsTile { @override Widget build(final BuildContext context) => ValueListenableBuilder( valueListenable: option, - builder: (final context, final value, final child) => CheckboxListTile.adaptive( - enabled: option.enabled, + builder: (final context, final value, final child) => SwitchListTile.adaptive( title: child, value: value, - onChanged: (final value) { - option.value = value!; - }, + onChanged: option.enabled ? (final value) => option.value = value : null, ), child: Text(option.label(context)), );