diff --git a/lib/modules/browse/extension/widgets/source_preference_widget.dart b/lib/modules/browse/extension/widgets/source_preference_widget.dart index 3611a1c6..0a534fd5 100644 --- a/lib/modules/browse/extension/widgets/source_preference_widget.dart +++ b/lib/modules/browse/extension/widgets/source_preference_widget.dart @@ -127,23 +127,25 @@ class _SourcePreferenceWidgetState extends State { ), content: SizedBox( width: context.width(0.8), - child: SuperListView.builder( - shrinkWrap: true, - itemCount: pref.entries!.length, - itemBuilder: (context, index) { - return RadioListTile( - dense: true, - contentPadding: const EdgeInsets.all(0), - value: index, - groupValue: pref.valueIndex, - onChanged: (value) { - Navigator.pop(context, index); - }, - title: Row( - children: [Text(pref.entries![index])], - ), - ); + child: RadioGroup( + groupValue: pref.valueIndex, + onChanged: (value) { + Navigator.pop(context, value); }, + child: SuperListView.builder( + shrinkWrap: true, + itemCount: pref.entries!.length, + itemBuilder: (context, index) { + return RadioListTile( + dense: true, + contentPadding: const EdgeInsets.all(0), + value: index, + title: Row( + children: [Text(pref.entries![index])], + ), + ); + }, + ), ), ), actions: [ diff --git a/lib/modules/history/history_screen.dart b/lib/modules/history/history_screen.dart index 99f64a61..44b964bc 100644 --- a/lib/modules/history/history_screen.dart +++ b/lib/modules/history/history_screen.dart @@ -64,7 +64,6 @@ class _HistoryScreenState extends ConsumerState } bool _isSearch = false; - // List _entriesData = []; // TODO. The variable is never used/modified @override Widget build(BuildContext context) { final hideItems = ref.watch(hideItemsStateProvider); diff --git a/lib/modules/manga/detail/manga_detail_view.dart b/lib/modules/manga/detail/manga_detail_view.dart index d147c826..2cd48510 100644 --- a/lib/modules/manga/detail/manga_detail_view.dart +++ b/lib/modules/manga/detail/manga_detail_view.dart @@ -1349,29 +1349,29 @@ class _MangaDetailViewState extends ConsumerState ), Consumer( builder: (context, ref, chil) { - return Column( - children: [ - RadioListTile( - dense: true, - title: Text(l10n.source_title), - value: "e", - groupValue: "e", - selected: true, - onChanged: (value) {}, - ), - RadioListTile( - dense: true, - title: Text( - widget.itemType != ItemType.anime - ? l10n.chapter_number - : l10n.episode_number, + return RadioGroup( + groupValue: "e", + onChanged: (value) {}, + child: Column( + children: [ + RadioListTile( + dense: true, + title: Text(l10n.source_title), + value: "e", + selected: true, ), - value: "ej", - groupValue: "e", - selected: false, - onChanged: (value) {}, - ), - ], + RadioListTile( + dense: true, + title: Text( + widget.itemType != ItemType.anime + ? l10n.chapter_number + : l10n.episode_number, + ), + value: "ej", + selected: false, + ), + ], + ), ); }, ), diff --git a/lib/modules/manga/detail/widgets/tracker_widget.dart b/lib/modules/manga/detail/widgets/tracker_widget.dart index b91fe0e4..95cefb4d 100644 --- a/lib/modules/manga/detail/widgets/tracker_widget.dart +++ b/lib/modules/manga/detail/widgets/tracker_widget.dart @@ -170,50 +170,45 @@ class _TrackerWidgetState extends ConsumerState { title: Text(l10n!.status), content: SizedBox( width: context.width(0.8), - child: SuperListView.builder( - shrinkWrap: true, - itemCount: ref - .read( - trackStateProvider( - track: widget.trackRes, - itemType: widget.itemType, - ).notifier, - ) - .getStatusList() - .length, - itemBuilder: (context, index) { - final status = ref + child: RadioGroup( + groupValue: toTrackStatus( + widget.trackRes.status, + widget.itemType, + widget.trackRes.syncId!, + ), + onChanged: (value) { + // Individual RadioListTile will handle the change + }, + child: SuperListView.builder( + shrinkWrap: true, + itemCount: ref .read( trackStateProvider( track: widget.trackRes, itemType: widget.itemType, ).notifier, ) - .getStatusList()[index]; - return RadioListTile( - dense: true, - contentPadding: const EdgeInsets.all(0), - value: status, - groupValue: toTrackStatus( - widget.trackRes.status, - widget.itemType, - widget.trackRes.syncId!, - ), - onChanged: (value) { - ref - .read( - trackStateProvider( - track: widget.trackRes - ..status = status, - itemType: widget.itemType, - ).notifier, - ) - .updateManga(); - Navigator.pop(context); - }, - title: Text(getTrackStatus(status, context)), - ); - }, + .getStatusList() + .length, + itemBuilder: (context, index) { + final status = ref + .read( + trackStateProvider( + track: widget.trackRes, + itemType: widget.itemType, + ).notifier, + ) + .getStatusList()[index]; + return RadioListTile( + dense: true, + contentPadding: const EdgeInsets.all(0), + value: status, + title: Text( + getTrackStatus(status, context), + ), + ); + }, + ), ), ), actions: [ diff --git a/lib/modules/manga/home/manga_home_screen.dart b/lib/modules/manga/home/manga_home_screen.dart index 8d7f3797..c4dcfdba 100644 --- a/lib/modules/manga/home/manga_home_screen.dart +++ b/lib/modules/manga/home/manga_home_screen.dart @@ -238,38 +238,29 @@ class _MangaHomeScreenState extends ConsumerState { return [ PopupMenuItem( value: 0, - child: RadioListTile( - title: Text(context.l10n.comfortable_grid), - value: DisplayType.comfortableGrid, - groupValue: displayType, - onChanged: (a) { - context.pop(); - displayTypeNotifier.setMangaHomeDisplayType(a!); - }, - ), - ), - PopupMenuItem( - value: 1, - child: RadioListTile( - title: Text(context.l10n.compact_grid), - value: DisplayType.compactGrid, - groupValue: displayType, - onChanged: (a) { - context.pop(); - displayTypeNotifier.setMangaHomeDisplayType(a!); - }, - ), - ), - PopupMenuItem( - value: 2, - child: RadioListTile( - title: Text(context.l10n.list), - value: DisplayType.list, + child: RadioGroup( groupValue: displayType, onChanged: (a) { context.pop(); displayTypeNotifier.setMangaHomeDisplayType(a!); }, + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + RadioListTile( + title: Text(context.l10n.comfortable_grid), + value: DisplayType.comfortableGrid, + ), + RadioListTile( + title: Text(context.l10n.compact_grid), + value: DisplayType.compactGrid, + ), + RadioListTile( + title: Text(context.l10n.list), + value: DisplayType.list, + ), + ], + ), ), ), ]; diff --git a/lib/modules/more/data_and_storage/data_and_storage.dart b/lib/modules/more/data_and_storage/data_and_storage.dart index f02a0432..e2cb352f 100644 --- a/lib/modules/more/data_and_storage/data_and_storage.dart +++ b/lib/modules/more/data_and_storage/data_and_storage.dart @@ -39,50 +39,48 @@ class DataAndStorage extends ConsumerWidget { title: Text(l10n.download_location), content: SizedBox( width: context.width(0.8), - child: SuperListView( - shrinkWrap: true, - children: [ - RadioListTile( - dense: true, - contentPadding: const EdgeInsets.all(0), - value: downloadLocationState.$2.isEmpty - ? downloadLocationState.$1 - : downloadLocationState.$2, - groupValue: downloadLocationState.$1, - onChanged: (value) { + child: RadioGroup( + groupValue: downloadLocationState.$2.isEmpty + ? downloadLocationState.$1 + : downloadLocationState.$2, + onChanged: (value) async { + if (value == downloadLocationState.$1) { + ref + .read(downloadLocationStateProvider.notifier) + .set(""); + Navigator.pop(context); + } else { + String? result = await FilePicker.platform + .getDirectoryPath(); + + if (result != null) { ref .read( downloadLocationStateProvider.notifier, ) - .set(""); - Navigator.pop(context); - }, - title: Text(downloadLocationState.$1), - ), - RadioListTile( - dense: true, - contentPadding: const EdgeInsets.all(0), - value: downloadLocationState.$2.isEmpty - ? downloadLocationState.$1 - : downloadLocationState.$2, - groupValue: downloadLocationState.$2, - onChanged: (value) async { - String? result = await FilePicker.platform - .getDirectoryPath(); - - if (result != null) { - ref - .read( - downloadLocationStateProvider.notifier, - ) - .set(result); - } else {} - if (!context.mounted) return; - Navigator.pop(context); - }, - title: Text(l10n.custom_location), - ), - ], + .set(result); + } else {} + if (!context.mounted) return; + Navigator.pop(context); + } + }, + child: SuperListView( + shrinkWrap: true, + children: [ + RadioListTile( + dense: true, + contentPadding: const EdgeInsets.all(0), + value: downloadLocationState.$1, + title: Text(downloadLocationState.$1), + ), + RadioListTile( + dense: true, + contentPadding: const EdgeInsets.all(0), + value: downloadLocationState.$2, + title: Text(l10n.custom_location), + ), + ], + ), ), ), actions: [ @@ -275,24 +273,26 @@ class DataAndStorage extends ConsumerWidget { title: Text(l10n.backup_frequency), content: SizedBox( width: context.width(0.8), - child: SuperListView.builder( - shrinkWrap: true, - itemCount: list.length, - itemBuilder: (context, index) { - return RadioListTile( - dense: true, - contentPadding: const EdgeInsets.all(0), - value: index, - groupValue: backupFrequency, - onChanged: (value) { - ref - .read(backupFrequencyStateProvider.notifier) - .set(value!); - Navigator.pop(context); - }, - title: Row(children: [Text(list[index])]), - ); + child: RadioGroup( + groupValue: backupFrequency, + onChanged: (value) { + ref + .read(backupFrequencyStateProvider.notifier) + .set(value!); + Navigator.pop(context); }, + child: SuperListView.builder( + shrinkWrap: true, + itemCount: list.length, + itemBuilder: (context, index) { + return RadioListTile( + dense: true, + contentPadding: const EdgeInsets.all(0), + value: index, + title: Row(children: [Text(list[index])]), + ); + }, + ), ), ), actions: [ diff --git a/lib/modules/more/settings/appearance/appearance_screen.dart b/lib/modules/more/settings/appearance/appearance_screen.dart index ab0e009f..c9712e31 100644 --- a/lib/modules/more/settings/appearance/appearance_screen.dart +++ b/lib/modules/more/settings/appearance/appearance_screen.dart @@ -146,25 +146,29 @@ class AppearanceScreen extends ConsumerWidget { title: Text(l10n.app_language), content: SizedBox( width: context.width(0.8), - child: SuperListView.builder( - shrinkWrap: true, - itemCount: AppLocalizations.supportedLocales.length, - itemBuilder: (context, index) { - final locale = AppLocalizations.supportedLocales[index]; - return RadioListTile( - dense: true, - contentPadding: const EdgeInsets.all(0), - value: locale, - groupValue: l10nLocale, - onChanged: (value) { - ref - .read(l10nLocaleStateProvider.notifier) - .setLocale(locale); - Navigator.pop(context); - }, - title: Text(completeLanguageName(locale.toLanguageTag())), - ); + child: RadioGroup( + groupValue: l10nLocale, + onChanged: (value) { + ref + .read(l10nLocaleStateProvider.notifier) + .setLocale(value!); + Navigator.pop(context); }, + child: SuperListView.builder( + shrinkWrap: true, + itemCount: AppLocalizations.supportedLocales.length, + itemBuilder: (context, index) { + final locale = AppLocalizations.supportedLocales[index]; + return RadioListTile( + dense: true, + contentPadding: const EdgeInsets.all(0), + value: locale, + title: Text( + completeLanguageName(locale.toLanguageTag()), + ), + ); + }, + ), ), ), actions: [ @@ -276,28 +280,29 @@ class AppearanceScreen extends ConsumerWidget { slivers: [ SliverPadding( padding: const EdgeInsets.all(0), - sliver: SuperSliverList.builder( - itemCount: values.length, - itemBuilder: (context, index) { - final value = values[index]; - return RadioListTile( - dense: true, - contentPadding: - const EdgeInsets.all(0), - value: value.value().fontFamily, - groupValue: appFontFamily, - onChanged: (value) { - ref - .read( - appFontFamilyProvider - .notifier, - ) - .set(value); - Navigator.pop(context); - }, - title: Text(value.key), - ); + sliver: RadioGroup( + groupValue: appFontFamily, + onChanged: (value) { + ref + .read( + appFontFamilyProvider.notifier, + ) + .set(value); + Navigator.pop(context); }, + child: SuperSliverList.builder( + itemCount: values.length, + itemBuilder: (context, index) { + final value = values[index]; + return RadioListTile( + dense: true, + contentPadding: + const EdgeInsets.all(0), + value: value.value().fontFamily, + title: Text(value.key), + ); + }, + ), ), ), ], @@ -364,28 +369,30 @@ class AppearanceScreen extends ConsumerWidget { title: Text(l10n.relative_timestamp), content: SizedBox( width: context.width(0.8), - child: SuperListView.builder( - shrinkWrap: true, - itemCount: relativeTimestampsList(context).length, - itemBuilder: (context, index) { - return RadioListTile( - dense: true, - contentPadding: const EdgeInsets.all(0), - value: index, - groupValue: relativeTimestamps, - onChanged: (value) { - ref - .read(relativeTimesTampsStateProvider.notifier) - .set(value!); - Navigator.pop(context); - }, - title: Row( - children: [ - Text(relativeTimestampsList(context)[index]), - ], - ), - ); + child: RadioGroup( + groupValue: relativeTimestamps, + onChanged: (value) { + ref + .read(relativeTimesTampsStateProvider.notifier) + .set(value!); + Navigator.pop(context); }, + child: SuperListView.builder( + shrinkWrap: true, + itemCount: relativeTimestampsList(context).length, + itemBuilder: (context, index) { + return RadioListTile( + dense: true, + contentPadding: const EdgeInsets.all(0), + value: index, + title: Row( + children: [ + Text(relativeTimestampsList(context)[index]), + ], + ), + ); + }, + ), ), ), actions: [ @@ -431,28 +438,30 @@ class AppearanceScreen extends ConsumerWidget { title: Text(l10n.date_format), content: SizedBox( width: context.width(0.8), - child: SuperListView.builder( - shrinkWrap: true, - itemCount: dateFormatsList.length, - itemBuilder: (context, index) { - return RadioListTile( - dense: true, - contentPadding: const EdgeInsets.all(0), - value: dateFormatsList[index], - groupValue: dateFormatState, - onChanged: (value) { - ref.read(dateFormatStateProvider.notifier).set(value!); - Navigator.pop(context); - }, - title: Row( - children: [ - Text( - "${dateFormatsList[index]} (${dateFormat(context: context, DateTime.now().millisecondsSinceEpoch.toString(), useRelativeTimesTamps: false, dateFormat: dateFormatsList[index], ref: ref)})", - ), - ], - ), - ); + child: RadioGroup( + groupValue: dateFormatState, + onChanged: (value) { + ref.read(dateFormatStateProvider.notifier).set(value!); + Navigator.pop(context); }, + child: SuperListView.builder( + shrinkWrap: true, + itemCount: dateFormatsList.length, + itemBuilder: (context, index) { + return RadioListTile( + dense: true, + contentPadding: const EdgeInsets.all(0), + value: dateFormatsList[index], + title: Row( + children: [ + Text( + "${dateFormatsList[index]} (${dateFormat(context: context, DateTime.now().millisecondsSinceEpoch.toString(), useRelativeTimesTamps: false, dateFormat: dateFormatsList[index], ref: ref)})", + ), + ], + ), + ); + }, + ), ), ), actions: [ diff --git a/lib/modules/more/settings/appearance/providers/theme_mode_state_provider.dart b/lib/modules/more/settings/appearance/providers/theme_mode_state_provider.dart index 6b661af3..bcbdfabf 100644 --- a/lib/modules/more/settings/appearance/providers/theme_mode_state_provider.dart +++ b/lib/modules/more/settings/appearance/providers/theme_mode_state_provider.dart @@ -1,5 +1,3 @@ -import 'dart:ui'; - import 'package:flutter/widgets.dart'; import 'package:mangayomi/main.dart'; import 'package:mangayomi/models/settings.dart'; diff --git a/lib/modules/more/settings/player/player_audio_screen.dart b/lib/modules/more/settings/player/player_audio_screen.dart index ceb75e1d..b6f64717 100644 --- a/lib/modules/more/settings/player/player_audio_screen.dart +++ b/lib/modules/more/settings/player/player_audio_screen.dart @@ -68,24 +68,26 @@ class _PlayerAudioScreenState extends ConsumerState { title: Text(context.l10n.audio_channels), content: SizedBox( width: context.width(0.8), - child: SuperListView.builder( - shrinkWrap: true, - itemCount: values.length, - itemBuilder: (context, index) { - return RadioListTile( - dense: true, - contentPadding: const EdgeInsets.all(0), - value: values[index].$1, - groupValue: audioChannel, - onChanged: (value) { - ref - .read(audioChannelStateProvider.notifier) - .set(value!); - Navigator.pop(context); - }, - title: Row(children: [Text(values[index].$2)]), - ); + child: RadioGroup( + groupValue: audioChannel, + onChanged: (value) { + ref + .read(audioChannelStateProvider.notifier) + .set(value!); + Navigator.pop(context); }, + child: SuperListView.builder( + shrinkWrap: true, + itemCount: values.length, + itemBuilder: (context, index) { + return RadioListTile( + dense: true, + contentPadding: const EdgeInsets.all(0), + value: values[index].$1, + title: Row(children: [Text(values[index].$2)]), + ); + }, + ), ), ), actions: [ diff --git a/lib/modules/more/settings/player/player_decoder_screen.dart b/lib/modules/more/settings/player/player_decoder_screen.dart index 3c63f5b2..c11ad34b 100644 --- a/lib/modules/more/settings/player/player_decoder_screen.dart +++ b/lib/modules/more/settings/player/player_decoder_screen.dart @@ -49,34 +49,36 @@ class _PlayerDecoderScreenState extends ConsumerState { title: Text(context.l10n.hwdec), content: SizedBox( width: context.width(0.8), - child: SuperListView.builder( - shrinkWrap: true, - itemCount: values.length, - itemBuilder: (context, index) { - return RadioListTile( - dense: true, - contentPadding: const EdgeInsets.all(0), - value: values[index].$1, - groupValue: hwdecMode, - onChanged: (value) { - ref - .read( - hwdecModeStateProvider( - rawValue: true, - ).notifier, - ) - .set(value!); - Navigator.pop(context); - }, - title: Row( - children: [ - Text( - "${values[index].$1} ${values[index].$2}", - ), - ], - ), - ); + child: RadioGroup( + groupValue: hwdecMode, + onChanged: (value) { + ref + .read( + hwdecModeStateProvider( + rawValue: true, + ).notifier, + ) + .set(value!); + Navigator.pop(context); }, + child: SuperListView.builder( + shrinkWrap: true, + itemCount: values.length, + itemBuilder: (context, index) { + return RadioListTile( + dense: true, + contentPadding: const EdgeInsets.all(0), + value: values[index].$1, + title: Row( + children: [ + Text( + "${values[index].$1} ${values[index].$2}", + ), + ], + ), + ); + }, + ), ), ), actions: [ @@ -130,24 +132,26 @@ class _PlayerDecoderScreenState extends ConsumerState { title: Text(context.l10n.debanding), content: SizedBox( width: context.width(0.8), - child: SuperListView.builder( - shrinkWrap: true, - itemCount: values.length, - itemBuilder: (context, index) { - return RadioListTile( - dense: true, - contentPadding: const EdgeInsets.all(0), - value: values[index].$1, - groupValue: debandingType, - onChanged: (value) { - ref - .read(debandingStateProvider.notifier) - .set(value!); - Navigator.pop(context); - }, - title: Row(children: [Text(values[index].$2)]), - ); + child: RadioGroup( + groupValue: debandingType, + onChanged: (value) { + ref + .read(debandingStateProvider.notifier) + .set(value!); + Navigator.pop(context); }, + child: SuperListView.builder( + shrinkWrap: true, + itemCount: values.length, + itemBuilder: (context, index) { + return RadioListTile( + dense: true, + contentPadding: const EdgeInsets.all(0), + value: values[index].$1, + title: Row(children: [Text(values[index].$2)]), + ); + }, + ), ), ), actions: [ diff --git a/lib/modules/more/settings/player/player_screen.dart b/lib/modules/more/settings/player/player_screen.dart index b0288bef..8792b15a 100644 --- a/lib/modules/more/settings/player/player_screen.dart +++ b/lib/modules/more/settings/player/player_screen.dart @@ -1,5 +1,3 @@ -import 'dart:io'; - import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:mangayomi/modules/more/settings/player/providers/player_state_provider.dart'; @@ -49,30 +47,30 @@ class _PlayerScreenState extends ConsumerState { title: Text(context.l10n.default_subtitle_language), content: SizedBox( width: context.width(0.8), - child: SuperListView.builder( - shrinkWrap: true, - itemCount: AppLocalizations.supportedLocales.length, - itemBuilder: (context, index) { - final locale = - AppLocalizations.supportedLocales[index]; - return RadioListTile( - dense: true, - contentPadding: const EdgeInsets.all(0), - value: locale, - groupValue: defaultSubtitleLang, - onChanged: (value) { - ref - .read( - defaultSubtitleLangStateProvider.notifier, - ) - .setLocale(locale); - Navigator.pop(context); - }, - title: Text( - completeLanguageName(locale.toLanguageTag()), - ), - ); + child: RadioGroup( + groupValue: defaultSubtitleLang, + onChanged: (value) { + ref + .read(defaultSubtitleLangStateProvider.notifier) + .setLocale(value!); + Navigator.pop(context); }, + child: SuperListView.builder( + shrinkWrap: true, + itemCount: AppLocalizations.supportedLocales.length, + itemBuilder: (context, index) { + final locale = + AppLocalizations.supportedLocales[index]; + return RadioListTile( + dense: true, + contentPadding: const EdgeInsets.all(0), + value: locale, + title: Text( + completeLanguageName(locale.toLanguageTag()), + ), + ); + }, + ), ), ), actions: [ @@ -111,27 +109,30 @@ class _PlayerScreenState extends ConsumerState { title: Text(context.l10n.markEpisodeAsSeenSetting), content: SizedBox( width: context.width(0.8), - child: SuperListView.builder( - shrinkWrap: true, - itemCount: values.length, - itemBuilder: (context, index) { - return RadioListTile( - dense: true, - contentPadding: const EdgeInsets.all(0), - value: values[index], - groupValue: markEpisodeAsSeenType, - onChanged: (value) { - ref - .read( - markEpisodeAsSeenTypeStateProvider - .notifier, - ) - .set(value!); - Navigator.pop(context); - }, - title: Row(children: [Text("${values[index]}%")]), - ); + child: RadioGroup( + groupValue: markEpisodeAsSeenType, + onChanged: (value) { + ref + .read( + markEpisodeAsSeenTypeStateProvider.notifier, + ) + .set(value!); + Navigator.pop(context); }, + child: SuperListView.builder( + shrinkWrap: true, + itemCount: values.length, + itemBuilder: (context, index) { + return RadioListTile( + dense: true, + contentPadding: const EdgeInsets.all(0), + value: values[index], + title: Row( + children: [Text("${values[index]}%")], + ), + ); + }, + ), ), ), actions: [ @@ -241,27 +242,31 @@ class _PlayerScreenState extends ConsumerState { ), content: SizedBox( width: context.width(0.8), - child: SuperListView.builder( - shrinkWrap: true, - itemCount: values.length, - itemBuilder: (context, index) { - return RadioListTile( - dense: true, - contentPadding: const EdgeInsets.all(0), - value: values[index], - groupValue: defaultDoubleTapToSkipLength, - onChanged: (value) { - ref - .read( - defaultDoubleTapToSkipLengthStateProvider - .notifier, - ) - .set(value!); - Navigator.pop(context); - }, - title: Row(children: [Text("${values[index]}s")]), - ); + child: RadioGroup( + groupValue: defaultDoubleTapToSkipLength, + onChanged: (value) { + ref + .read( + defaultDoubleTapToSkipLengthStateProvider + .notifier, + ) + .set(value!); + Navigator.pop(context); }, + child: SuperListView.builder( + shrinkWrap: true, + itemCount: values.length, + itemBuilder: (context, index) { + return RadioListTile( + dense: true, + contentPadding: const EdgeInsets.all(0), + value: values[index], + title: Row( + children: [Text("${values[index]}s")], + ), + ); + }, + ), ), ), actions: [ @@ -300,27 +305,30 @@ class _PlayerScreenState extends ConsumerState { title: Text(context.l10n.default_playback_speed_length), content: SizedBox( width: context.width(0.8), - child: SuperListView.builder( - shrinkWrap: true, - itemCount: values.length, - itemBuilder: (context, index) { - return RadioListTile( - dense: true, - contentPadding: const EdgeInsets.all(0), - value: values[index], - groupValue: defaultPlayBackSpeed, - onChanged: (value) { - ref - .read( - defaultPlayBackSpeedStateProvider - .notifier, - ) - .set(value!); - Navigator.pop(context); - }, - title: Row(children: [Text("x${values[index]}")]), - ); + child: RadioGroup( + groupValue: defaultPlayBackSpeed, + onChanged: (value) { + ref + .read( + defaultPlayBackSpeedStateProvider.notifier, + ) + .set(value!); + Navigator.pop(context); }, + child: SuperListView.builder( + shrinkWrap: true, + itemCount: values.length, + itemBuilder: (context, index) { + return RadioListTile( + dense: true, + contentPadding: const EdgeInsets.all(0), + value: values[index], + title: Row( + children: [Text("x${values[index]}")], + ), + ); + }, + ), ), ), actions: [ @@ -408,29 +416,31 @@ class _PlayerScreenState extends ConsumerState { ), content: SizedBox( width: context.width(0.8), - child: SuperListView.builder( - shrinkWrap: true, - itemCount: values.length, - itemBuilder: (context, index) { - return RadioListTile( - dense: true, - contentPadding: const EdgeInsets.all(0), - value: values[index], - groupValue: aniSkipTimeoutLength, - onChanged: (value) { - ref - .read( - aniSkipTimeoutLengthStateProvider - .notifier, - ) - .set(value!); - Navigator.pop(context); - }, - title: Row( - children: [Text("${values[index]}s")], - ), - ); + child: RadioGroup( + groupValue: aniSkipTimeoutLength, + onChanged: (value) { + ref + .read( + aniSkipTimeoutLengthStateProvider + .notifier, + ) + .set(value!); + Navigator.pop(context); }, + child: SuperListView.builder( + shrinkWrap: true, + itemCount: values.length, + itemBuilder: (context, index) { + return RadioListTile( + dense: true, + contentPadding: const EdgeInsets.all(0), + value: values[index], + title: Row( + children: [Text("${values[index]}s")], + ), + ); + }, + ), ), ), actions: [ diff --git a/lib/modules/more/settings/reader/reader_screen.dart b/lib/modules/more/settings/reader/reader_screen.dart index 6a36542a..b72e32c6 100644 --- a/lib/modules/more/settings/reader/reader_screen.dart +++ b/lib/modules/more/settings/reader/reader_screen.dart @@ -39,35 +39,35 @@ class ReaderScreen extends ConsumerWidget { title: Text(context.l10n.default_reading_mode), content: SizedBox( width: context.width(0.8), - child: SuperListView.builder( - shrinkWrap: true, - itemCount: ReaderMode.values.length, - itemBuilder: (context, index) { - return RadioListTile( - dense: true, - contentPadding: const EdgeInsets.all(0), - value: ReaderMode.values[index], - groupValue: defaultReadingMode, - onChanged: (value) { - ref - .read( - defaultReadingModeStateProvider.notifier, - ) - .set(value!); - Navigator.pop(context); - }, - title: Row( - children: [ - Text( - getReaderModeName( - ReaderMode.values[index], - context, - ), - ), - ], - ), - ); + child: RadioGroup( + groupValue: defaultReadingMode, + onChanged: (value) { + ref + .read(defaultReadingModeStateProvider.notifier) + .set(value!); + Navigator.pop(context); }, + child: SuperListView.builder( + shrinkWrap: true, + itemCount: ReaderMode.values.length, + itemBuilder: (context, index) { + return RadioListTile( + dense: true, + contentPadding: const EdgeInsets.all(0), + value: ReaderMode.values[index], + title: Row( + children: [ + Text( + getReaderModeName( + ReaderMode.values[index], + context, + ), + ), + ], + ), + ); + }, + ), ), ), actions: [ @@ -105,31 +105,32 @@ class ReaderScreen extends ConsumerWidget { title: Text(context.l10n.double_tap_animation_speed), content: SizedBox( width: context.width(0.8), - child: SuperListView.builder( - shrinkWrap: true, - itemCount: 3, - itemBuilder: (context, index) { - return RadioListTile( - dense: true, - contentPadding: const EdgeInsets.all(0), - value: index, - groupValue: doubleTapAnimationSpeed, - onChanged: (value) { - ref - .read( - doubleTapAnimationSpeedStateProvider - .notifier, - ) - .set(value!); - Navigator.pop(context); - }, - title: Row( - children: [ - Text(getAnimationSpeedName(index, context)), - ], - ), - ); + child: RadioGroup( + groupValue: doubleTapAnimationSpeed, + onChanged: (value) { + ref + .read( + doubleTapAnimationSpeedStateProvider.notifier, + ) + .set(value!); + Navigator.pop(context); }, + child: SuperListView.builder( + shrinkWrap: true, + itemCount: 3, + itemBuilder: (context, index) { + return RadioListTile( + dense: true, + contentPadding: const EdgeInsets.all(0), + value: index, + title: Row( + children: [ + Text(getAnimationSpeedName(index, context)), + ], + ), + ); + }, + ), ), ), actions: [ @@ -167,33 +168,35 @@ class ReaderScreen extends ConsumerWidget { title: Text(context.l10n.background_color), content: SizedBox( width: context.width(0.8), - child: SuperListView.builder( - shrinkWrap: true, - itemCount: BackgroundColor.values.length, - itemBuilder: (context, index) { - return RadioListTile( - dense: true, - contentPadding: const EdgeInsets.all(0), - value: BackgroundColor.values[index], - groupValue: backgroundColor, - onChanged: (value) { - ref - .read(backgroundColorStateProvider.notifier) - .set(value!); - Navigator.pop(context); - }, - title: Row( - children: [ - Text( - getBackgroundColorName( - BackgroundColor.values[index], - context, - ), - ), - ], - ), - ); + child: RadioGroup( + groupValue: backgroundColor, + onChanged: (value) { + ref + .read(backgroundColorStateProvider.notifier) + .set(value!); + Navigator.pop(context); }, + child: SuperListView.builder( + shrinkWrap: true, + itemCount: BackgroundColor.values.length, + itemBuilder: (context, index) { + return RadioListTile( + dense: true, + contentPadding: const EdgeInsets.all(0), + value: BackgroundColor.values[index], + title: Row( + children: [ + Text( + getBackgroundColorName( + BackgroundColor.values[index], + context, + ), + ), + ], + ), + ); + }, + ), ), ), actions: [ @@ -301,32 +304,34 @@ class ReaderScreen extends ConsumerWidget { title: Text(context.l10n.scale_type), content: SizedBox( width: context.width(0.8), - child: SuperListView.builder( - shrinkWrap: true, - itemCount: getScaleTypeNames(context).length, - itemBuilder: (context, index) { - return RadioListTile( - // dense: true, - contentPadding: const EdgeInsets.all(0), - value: index, - groupValue: scaleType.index, - onChanged: (value) { - ref - .read(scaleTypeStateProvider.notifier) - .set(ScaleType.values[value!]); - Navigator.pop(context); - }, - title: Row( - children: [ - Text( - getScaleTypeNames( - context, - )[index].toString(), - ), - ], - ), - ); + child: RadioGroup( + groupValue: scaleType.index, + onChanged: (value) { + ref + .read(scaleTypeStateProvider.notifier) + .set(ScaleType.values[value!]); + Navigator.pop(context); }, + child: SuperListView.builder( + shrinkWrap: true, + itemCount: getScaleTypeNames(context).length, + itemBuilder: (context, index) { + return RadioListTile( + // dense: true, + contentPadding: const EdgeInsets.all(0), + value: index, + title: Row( + children: [ + Text( + getScaleTypeNames( + context, + )[index].toString(), + ), + ], + ), + ); + }, + ), ), ), actions: [ diff --git a/lib/modules/more/settings/sync/sync.dart b/lib/modules/more/settings/sync/sync.dart index db68dbf6..97f01536 100644 --- a/lib/modules/more/settings/sync/sync.dart +++ b/lib/modules/more/settings/sync/sync.dart @@ -65,30 +65,30 @@ class SyncScreen extends ConsumerWidget { title: Text(l10n.sync_auto), content: SizedBox( width: context.width(0.8), - child: SuperListView.builder( - shrinkWrap: true, - itemCount: autoSyncOptions.length, - itemBuilder: (context, index) { - final optionName = autoSyncOptions.keys - .elementAt(index); - final optionValue = autoSyncOptions.values - .elementAt(index); - return RadioListTile( - dense: true, - contentPadding: const EdgeInsets.all(0), - value: optionValue, - groupValue: syncPreference.autoSyncFrequency, - onChanged: (value) { - ref - .read( - synchingProvider(syncId: 1).notifier, - ) - .setAutoSyncFrequency(value!); - Navigator.pop(context); - }, - title: Text(optionName), - ); + child: RadioGroup( + groupValue: syncPreference.autoSyncFrequency, + onChanged: (value) { + ref + .read(synchingProvider(syncId: 1).notifier) + .setAutoSyncFrequency(value!); + Navigator.pop(context); }, + child: SuperListView.builder( + shrinkWrap: true, + itemCount: autoSyncOptions.length, + itemBuilder: (context, index) { + final optionName = autoSyncOptions.keys + .elementAt(index); + final optionValue = autoSyncOptions.values + .elementAt(index); + return RadioListTile( + dense: true, + contentPadding: const EdgeInsets.all(0), + value: optionValue, + title: Text(optionName), + ); + }, + ), ), ), actions: [ diff --git a/macos/Podfile.lock b/macos/Podfile.lock index 3cb86648..cafe10dc 100644 --- a/macos/Podfile.lock +++ b/macos/Podfile.lock @@ -164,7 +164,7 @@ SPEC CHECKSUMS: flutter_inappwebview_macos: c2d68649f9f8f1831bfcd98d73fd6256366d9d1d flutter_qjs: cb2d0cba9deade1d03b89f6c432eac126f39482a flutter_web_auth_2: 62b08da29f15a20fa63f144234622a1488d45b65 - FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24 + FlutterMacOS: d0db08ddef1a9af05a5ec4b724367152bb0500b1 isar_flutter_libs: a65381780401f81ad6bf3f2e7cd0de5698fb98c4 just_audio: 4e391f57b79cad2b0674030a00453ca5ce817eed media_kit_libs_macos_video: 85a23e549b5f480e72cae3e5634b5514bc692f65