diff --git a/lib/screens/settings/download_settings_page.dart b/lib/screens/settings/download_settings_page.dart index ebc6eaf0..581abbbf 100644 --- a/lib/screens/settings/download_settings_page.dart +++ b/lib/screens/settings/download_settings_page.dart @@ -486,7 +486,6 @@ class _DownloadSettingsPageState extends ConsumerState { WidgetRef ref, String current, ) { - final colorScheme = Theme.of(context).colorScheme; showAppScrollableBottomSheet( context: context, title: context.l10n.settingsDownloadNetwork, @@ -497,14 +496,11 @@ class _DownloadSettingsPageState extends ConsumerState { mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, children: [ - AppSheetOption( + AppSheetOption.choice( leading: const AppIcon(Icons.signal_cellular_alt), title: Text(context.l10n.settingsDownloadNetworkAny), subtitle: Text(context.l10n.downloadNetworkAnySubtitle), selected: current == 'any', - trailing: current == 'any' - ? AppIcon(Icons.check, color: colorScheme.primary) - : null, onTap: () { ref .read(settingsProvider.notifier) @@ -512,14 +508,11 @@ class _DownloadSettingsPageState extends ConsumerState { Navigator.pop(context); }, ), - AppSheetOption( + AppSheetOption.choice( leading: const AppIcon(Icons.wifi), title: Text(context.l10n.settingsDownloadNetworkWifiOnly), subtitle: Text(context.l10n.downloadNetworkWifiOnlySubtitle), selected: current == 'wifi_only', - trailing: current == 'wifi_only' - ? AppIcon(Icons.check, color: colorScheme.primary) - : null, onTap: () { ref .read(settingsProvider.notifier) @@ -870,13 +863,10 @@ class _RegionPickerSheetState extends State<_RegionPickerSheet> { final code = matches[index]; final isSelected = code == widget.selected; final countryName = widget.countryNameOf(context, code); - return AppSheetOption( + return AppSheetOption.choice( title: Text(countryName != code ? countryName : code), subtitle: countryName != code ? Text(code) : null, selected: isSelected, - trailing: isSelected - ? AppIcon(Icons.check, color: colorScheme.primary) - : null, onTap: () => widget.onSelected(code), ); }, diff --git a/lib/screens/settings/extension_detail_page.dart b/lib/screens/settings/extension_detail_page.dart index 8f4f5ad3..447eef3f 100644 --- a/lib/screens/settings/extension_detail_page.dart +++ b/lib/screens/settings/extension_detail_page.dart @@ -1119,11 +1119,9 @@ class _SettingItemState extends State<_SettingItem> { mainAxisSize: MainAxisSize.min, children: [ for (final option in widget.setting.options ?? []) - AppSheetOption( + AppSheetOption.choice( title: Text(option), - trailing: option == widget.value - ? const AppIcon(CupertinoIcons.check_mark) - : null, + selected: option == widget.value, onTap: () => Navigator.pop(sheetContext, option), ), ], diff --git a/lib/screens/settings/files_settings_page.dart b/lib/screens/settings/files_settings_page.dart index 9d7f6d70..32cbd63f 100644 --- a/lib/screens/settings/files_settings_page.dart +++ b/lib/screens/settings/files_settings_page.dart @@ -532,7 +532,7 @@ class _FilesSettingsPageState extends ConsumerState { mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, children: [ - AppSheetOption( + AppSheetOption.choice( leading: AppIcon( Icons.folder_special, color: colorScheme.primary, @@ -540,7 +540,6 @@ class _FilesSettingsPageState extends ConsumerState { title: Text(context.l10n.storageAutomaticFolder), subtitle: Text(context.l10n.storageAutomaticDownloadFolder), selected: !isSafMode, - trailing: !isSafMode ? const AppIcon(Icons.check) : null, onTap: () async { Navigator.pop(ctx); final defaultDir = await _getDefaultAndroidDirectory(); @@ -550,12 +549,11 @@ class _FilesSettingsPageState extends ConsumerState { notifier.setDownloadTreeUri(''); }, ), - AppSheetOption( + AppSheetOption.choice( leading: AppIcon(Icons.folder_open, color: colorScheme.primary), title: Text(context.l10n.storageSafRecommended), subtitle: Text(context.l10n.storageDownloadFolderHint), selected: isSafMode, - trailing: isSafMode ? const AppIcon(Icons.check) : null, onTap: () async { Navigator.pop(ctx); await _pickSafTreeAndSave(); @@ -757,14 +755,11 @@ class _FilesSettingsPageState extends ConsumerState { Icons.person_outline_outlined, ), ]) - AppSheetOption( + AppSheetOption.choice( leading: AppIcon(option.$4), title: Text(option.$2), subtitle: Text(option.$3), selected: current == option.$1, - trailing: current == option.$1 - ? const AppIcon(Icons.check) - : null, onTap: () { ref .read(settingsProvider.notifier) diff --git a/lib/screens/settings/library_settings_page.dart b/lib/screens/settings/library_settings_page.dart index 22a5983d..32298f2b 100644 --- a/lib/screens/settings/library_settings_page.dart +++ b/lib/screens/settings/library_settings_page.dart @@ -335,7 +335,6 @@ class _LibrarySettingsPageState extends ConsumerState { } void _showAutoScanPicker(BuildContext context, String current) { - final colorScheme = Theme.of(context).colorScheme; showAppScrollableBottomSheet( context: context, title: context.l10n.libraryAutoScan, @@ -350,7 +349,6 @@ class _LibrarySettingsPageState extends ConsumerState { icon: Icons.block, title: context.l10n.libraryAutoScanOff, selected: current == 'off', - colorScheme: colorScheme, onTap: () { ref .read(settingsProvider.notifier) @@ -362,7 +360,6 @@ class _LibrarySettingsPageState extends ConsumerState { icon: Icons.open_in_new, title: context.l10n.libraryAutoScanOnOpen, selected: current == 'on_open', - colorScheme: colorScheme, onTap: () { ref .read(settingsProvider.notifier) @@ -374,7 +371,6 @@ class _LibrarySettingsPageState extends ConsumerState { icon: Icons.today, title: context.l10n.libraryAutoScanDaily, selected: current == 'daily', - colorScheme: colorScheme, onTap: () { ref .read(settingsProvider.notifier) @@ -386,7 +382,6 @@ class _LibrarySettingsPageState extends ConsumerState { icon: Icons.date_range, title: context.l10n.libraryAutoScanWeekly, selected: current == 'weekly', - colorScheme: colorScheme, onTap: () { ref .read(settingsProvider.notifier) @@ -419,7 +414,6 @@ class _LibrarySettingsPageState extends ConsumerState { } void _showDefaultViewPicker(BuildContext context, String current) { - final colorScheme = Theme.of(context).colorScheme; final options = [ ('last', Icons.history, context.l10n.libraryDefaultViewLastUsed), ('all', Icons.music_note, context.l10n.searchSongs), @@ -442,7 +436,6 @@ class _LibrarySettingsPageState extends ConsumerState { icon: icon, title: label, selected: current == value, - colorScheme: colorScheme, onTap: () { ref .read(settingsProvider.notifier) @@ -476,7 +469,6 @@ class _LibrarySettingsPageState extends ConsumerState { } void _showQualityLabelModePicker(BuildContext context, String current) { - final colorScheme = Theme.of(context).colorScheme; final options = [ ( AppSettings.libraryQualityLabelBitrate, @@ -520,7 +512,6 @@ class _LibrarySettingsPageState extends ConsumerState { icon: icon, title: label, selected: current == value, - colorScheme: colorScheme, onTap: () { ref .read(settingsProvider.notifier) @@ -1541,26 +1532,21 @@ class _AutoScanOption extends StatelessWidget { final IconData icon; final String title; final bool selected; - final ColorScheme colorScheme; final VoidCallback onTap; const _AutoScanOption({ required this.icon, required this.title, required this.selected, - required this.colorScheme, required this.onTap, }); @override Widget build(BuildContext context) { - return AppSheetOption( + return AppSheetOption.choice( leading: AppIcon(icon), title: Text(title), selected: selected, - trailing: selected - ? AppIcon(Icons.check, color: colorScheme.primary) - : null, onTap: onTap, ); } diff --git a/lib/screens/settings/lyrics_settings_page.dart b/lib/screens/settings/lyrics_settings_page.dart index cc2846d1..4d9e2ef8 100644 --- a/lib/screens/settings/lyrics_settings_page.dart +++ b/lib/screens/settings/lyrics_settings_page.dart @@ -240,36 +240,31 @@ class LyricsSettingsPage extends ConsumerWidget { mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, children: [ - AppSheetOption( + AppSheetOption.choice( leading: const AppIcon(Icons.audiotrack), title: Text(context.l10n.lyricsModeEmbed), subtitle: Text(context.l10n.lyricsModeEmbedSubtitle), selected: current == 'embed', - trailing: current == 'embed' ? const AppIcon(Icons.check) : null, onTap: () { ref.read(settingsProvider.notifier).setLyricsMode('embed'); Navigator.pop(context); }, ), - AppSheetOption( + AppSheetOption.choice( leading: const AppIcon(Icons.insert_drive_file_outlined), title: Text(context.l10n.lyricsModeExternal), subtitle: Text(context.l10n.lyricsModeExternalSubtitle), selected: current == 'external', - trailing: current == 'external' - ? const AppIcon(Icons.check) - : null, onTap: () { ref.read(settingsProvider.notifier).setLyricsMode('external'); Navigator.pop(context); }, ), - AppSheetOption( + AppSheetOption.choice( leading: const AppIcon(Icons.library_music_outlined), title: Text(context.l10n.lyricsModeBoth), subtitle: Text(context.l10n.lyricsModeBothSubtitle), selected: current == 'both', - trailing: current == 'both' ? const AppIcon(Icons.check) : null, onTap: () { ref.read(settingsProvider.notifier).setLyricsMode('both'); Navigator.pop(context); diff --git a/lib/screens/settings/metadata_settings_page.dart b/lib/screens/settings/metadata_settings_page.dart index 3f01e074..990b9db7 100644 --- a/lib/screens/settings/metadata_settings_page.dart +++ b/lib/screens/settings/metadata_settings_page.dart @@ -197,7 +197,7 @@ class MetadataSettingsPage extends ConsumerWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ for (final maxDimension in options) - AppSheetOption( + AppSheetOption.choice( leading: AppIcon( maxDimension == 0 ? Icons.image_outlined @@ -205,9 +205,6 @@ class MetadataSettingsPage extends ConsumerWidget { ), title: Text(_getEmbeddedCoverSizeLabel(context, maxDimension)), selected: currentMaxDimension == maxDimension, - trailing: currentMaxDimension == maxDimension - ? const AppIcon(Icons.check) - : null, onTap: () { ref .read(settingsProvider.notifier) @@ -237,14 +234,11 @@ class MetadataSettingsPage extends ConsumerWidget { mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, children: [ - AppSheetOption( + AppSheetOption.choice( leading: const AppIcon(Icons.segment_outlined), title: Text(context.l10n.optionsArtistTagModeJoined), subtitle: Text(context.l10n.optionsArtistTagModeJoinedSubtitle), selected: currentMode == artistTagModeJoined, - trailing: currentMode == artistTagModeJoined - ? const AppIcon(Icons.check) - : null, onTap: () { ref .read(settingsProvider.notifier) @@ -252,16 +246,13 @@ class MetadataSettingsPage extends ConsumerWidget { Navigator.pop(context); }, ), - AppSheetOption( + AppSheetOption.choice( leading: const AppIcon(Icons.library_music_outlined), title: Text(context.l10n.optionsArtistTagModeSplitVorbis), subtitle: Text( context.l10n.optionsArtistTagModeSplitVorbisSubtitle, ), selected: currentMode == artistTagModeSplitVorbis, - trailing: currentMode == artistTagModeSplitVorbis - ? const AppIcon(Icons.check) - : null, onTap: () { ref .read(settingsProvider.notifier) @@ -269,14 +260,11 @@ class MetadataSettingsPage extends ConsumerWidget { Navigator.pop(context); }, ), - AppSheetOption( + AppSheetOption.choice( leading: const AppIcon(Icons.person_outline), title: Text(context.l10n.optionsArtistTagModePrimary), subtitle: Text(context.l10n.optionsArtistTagModePrimarySubtitle), selected: currentMode == artistTagModePrimary, - trailing: currentMode == artistTagModePrimary - ? const AppIcon(Icons.check) - : null, onTap: () { ref .read(settingsProvider.notifier) diff --git a/lib/utils/extension_action_forms.dart b/lib/utils/extension_action_forms.dart index 878f701e..44ce82c6 100644 --- a/lib/utils/extension_action_forms.dart +++ b/lib/utils/extension_action_forms.dart @@ -216,16 +216,10 @@ class _AccountFormDialogState extends State<_AccountFormDialog> { mainAxisSize: MainAxisSize.min, children: [ for (final option in (field['options'] as List).cast()) - Semantics( + AppSheetOption.choice( + title: Text(option), selected: option == _choices[key], - child: AppSheetOption( - title: Text(option), - selected: option == _choices[key], - trailing: option == _choices[key] - ? const Icon(Icons.check) - : null, - onTap: () => Navigator.pop(sheetContext, option), - ), + onTap: () => Navigator.pop(sheetContext, option), ), ], ),