From 1b9ba8edde31594292d037e8563f8800b6221c8e Mon Sep 17 00:00:00 2001 From: Ben Hills Date: Tue, 9 Apr 2024 16:38:32 +0100 Subject: [PATCH] Reduce amount of swiping required to access toggle buttons via screen reader. --- lib/ui/settings/settings.dart | 74 +++++++++++++++++++---------------- 1 file changed, 41 insertions(+), 33 deletions(-) diff --git a/lib/ui/settings/settings.dart b/lib/ui/settings/settings.dart index 2c30649d..4d7cea75 100644 --- a/lib/ui/settings/settings.dart +++ b/lib/ui/settings/settings.dart @@ -58,39 +58,45 @@ class _SettingsState extends State { return ListView( children: [ SettingsDividerLabel(label: L.of(context)!.settings_personalisation_divider_label), - ListTile( - shape: const RoundedRectangleBorder(side: BorderSide.none), - title: Text(L.of(context)!.settings_theme_switch_label), - trailing: Switch.adaptive( - value: snapshot.data!.theme == 'dark', - onChanged: (value) { - settingsBloc.darkMode(value); - }), + MergeSemantics( + child: ListTile( + shape: const RoundedRectangleBorder(side: BorderSide.none), + title: Text(L.of(context)!.settings_theme_switch_label), + trailing: Switch.adaptive( + value: snapshot.data!.theme == 'dark', + onChanged: (value) { + settingsBloc.darkMode(value); + }), + ), ), SettingsDividerLabel(label: L.of(context)!.settings_episodes_divider_label), - ListTile( - title: Text(L.of(context)!.settings_mark_deleted_played_label), - trailing: Switch.adaptive( - value: snapshot.data!.markDeletedEpisodesAsPlayed, - onChanged: (value) => setState(() => settingsBloc.markDeletedAsPlayed(value)), + MergeSemantics( + child: ListTile( + title: Text(L.of(context)!.settings_mark_deleted_played_label), + trailing: Switch.adaptive( + value: snapshot.data!.markDeletedEpisodesAsPlayed, + onChanged: (value) => setState(() => settingsBloc.markDeletedAsPlayed(value)), + ), ), ), sdcard - ? ListTile( - title: Text(L.of(context)!.settings_download_sd_card_label), - trailing: Switch.adaptive( - value: snapshot.data!.storeDownloadsSDCard, - onChanged: (value) => sdcard - ? setState(() { - if (value) { - _showStorageDialog(enableExternalStorage: true); - } else { - _showStorageDialog(enableExternalStorage: false); - } - - settingsBloc.storeDownloadonSDCard(value); - }) - : null, + ? MergeSemantics( + child: ListTile( + title: Text(L.of(context)!.settings_download_sd_card_label), + trailing: Switch.adaptive( + value: snapshot.data!.storeDownloadsSDCard, + onChanged: (value) => sdcard + ? setState(() { + if (value) { + _showStorageDialog(enableExternalStorage: true); + } else { + _showStorageDialog(enableExternalStorage: false); + } + + settingsBloc.storeDownloadonSDCard(value); + }) + : null, + ), ), ) : const SizedBox( @@ -98,11 +104,13 @@ class _SettingsState extends State { width: 0, ), SettingsDividerLabel(label: L.of(context)!.settings_playback_divider_label), - ListTile( - title: Text(L.of(context)!.settings_auto_open_now_playing), - trailing: Switch.adaptive( - value: snapshot.data!.autoOpenNowPlaying, - onChanged: (value) => setState(() => settingsBloc.setAutoOpenNowPlaying(value)), + MergeSemantics( + child: ListTile( + title: Text(L.of(context)!.settings_auto_open_now_playing), + trailing: Switch.adaptive( + value: snapshot.data!.autoOpenNowPlaying, + onChanged: (value) => setState(() => settingsBloc.setAutoOpenNowPlaying(value)), + ), ), ), const EpisodeRefreshWidget(),