Skip to content

A cross platform Audiobookshelf client for Android and iOS

Dart

Add a settings search that jumps to and highlights the setting

Barnabasc78e22d25da9
diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb
index 6c2df2cb..dfa3954f 100644
--- a/lib/l10n/app_en.arb
+++ b/lib/l10n/app_en.arb
@@ -4114,7 +4114,10 @@
"androidAutoTabContinue": "Continue",
"androidAutoTabLibrary": "Library",
"androidAutoTabDownloads": "Downloads",
+ "settingsSearchHint": "Search settings...",
+ "settingsSearchNoResults": "No matching settings",
"carConnectAutoplay": "Start playback when Android Auto connects",
+ "carConnectAutoplayIos": "Start playback when CarPlay connects",
"carConnectAutoplayOnSubtitle": "The last book you were listening to starts by itself when the car connects",
"carConnectAutoplayOffSubtitle": "Playback waits for you to press play",
"androidAutoCatBooks": "Books",
diff --git a/lib/l10n/app_localizations.dart b/lib/l10n/app_localizations.dart
index e885dcc2..6c097ada 100644
--- a/lib/l10n/app_localizations.dart
+++ b/lib/l10n/app_localizations.dart
@@ -11781,12 +11781,30 @@ abstract class AppLocalizations {
/// **'Downloads'**
String get androidAutoTabDownloads;
+ /// No description provided for @settingsSearchHint.
+ ///
+ /// In en, this message translates to:
+ /// **'Search settings...'**
+ String get settingsSearchHint;
+
+ /// No description provided for @settingsSearchNoResults.
+ ///
+ /// In en, this message translates to:
+ /// **'No matching settings'**
+ String get settingsSearchNoResults;
+
/// No description provided for @carConnectAutoplay.
///
/// In en, this message translates to:
/// **'Start playback when Android Auto connects'**
String get carConnectAutoplay;
+ /// No description provided for @carConnectAutoplayIos.
+ ///
+ /// In en, this message translates to:
+ /// **'Start playback when CarPlay connects'**
+ String get carConnectAutoplayIos;
+
/// No description provided for @carConnectAutoplayOnSubtitle.
///
/// In en, this message translates to:
diff --git a/lib/l10n/app_localizations_de.dart b/lib/l10n/app_localizations_de.dart
index 64899c94..5374ac8b 100644
--- a/lib/l10n/app_localizations_de.dart
+++ b/lib/l10n/app_localizations_de.dart
@@ -6975,9 +6975,18 @@ class AppLocalizationsDe extends AppLocalizations {
@override
String get androidAutoTabDownloads => 'Downloads';
+ @override
+ String get settingsSearchHint => 'Search settings...';
+
+ @override
+ String get settingsSearchNoResults => 'No matching settings';
+
@override
String get carConnectAutoplay => 'Start playback when Android Auto connects';
+ @override
+ String get carConnectAutoplayIos => 'Start playback when CarPlay connects';
+
@override
String get carConnectAutoplayOnSubtitle =>
'The last book you were listening to starts by itself when the car connects';
diff --git a/lib/l10n/app_localizations_el.dart b/lib/l10n/app_localizations_el.dart
index 07887982..d764a841 100644
--- a/lib/l10n/app_localizations_el.dart
+++ b/lib/l10n/app_localizations_el.dart
@@ -6883,9 +6883,18 @@ class AppLocalizationsEl extends AppLocalizations {
@override
String get androidAutoTabDownloads => 'Downloads';
+ @override
+ String get settingsSearchHint => 'Search settings...';
+
+ @override
+ String get settingsSearchNoResults => 'No matching settings';
+
@override
String get carConnectAutoplay => 'Start playback when Android Auto connects';
+ @override
+ String get carConnectAutoplayIos => 'Start playback when CarPlay connects';
+
@override
String get carConnectAutoplayOnSubtitle =>
'The last book you were listening to starts by itself when the car connects';
diff --git a/lib/l10n/app_localizations_en.dart b/lib/l10n/app_localizations_en.dart
index 8885e40e..03baa64c 100644
--- a/lib/l10n/app_localizations_en.dart
+++ b/lib/l10n/app_localizations_en.dart
@@ -6883,9 +6883,18 @@ class AppLocalizationsEn extends AppLocalizations {
@override
String get androidAutoTabDownloads => 'Downloads';
+ @override
+ String get settingsSearchHint => 'Search settings...';
+
+ @override
+ String get settingsSearchNoResults => 'No matching settings';
+
@override
String get carConnectAutoplay => 'Start playback when Android Auto connects';
+ @override
+ String get carConnectAutoplayIos => 'Start playback when CarPlay connects';
+
@override
String get carConnectAutoplayOnSubtitle =>
'The last book you were listening to starts by itself when the car connects';
diff --git a/lib/l10n/app_localizations_es.dart b/lib/l10n/app_localizations_es.dart
index d8e32d93..79806c82 100644
--- a/lib/l10n/app_localizations_es.dart
+++ b/lib/l10n/app_localizations_es.dart
@@ -6885,9 +6885,18 @@ class AppLocalizationsEs extends AppLocalizations {
@override
String get androidAutoTabDownloads => 'Downloads';
+ @override
+ String get settingsSearchHint => 'Search settings...';
+
+ @override
+ String get settingsSearchNoResults => 'No matching settings';
+
@override
String get carConnectAutoplay => 'Start playback when Android Auto connects';
+ @override
+ String get carConnectAutoplayIos => 'Start playback when CarPlay connects';
+
@override
String get carConnectAutoplayOnSubtitle =>
'The last book you were listening to starts by itself when the car connects';
diff --git a/lib/l10n/app_localizations_fr.dart b/lib/l10n/app_localizations_fr.dart
index b16be6b2..8a955b33 100644
--- a/lib/l10n/app_localizations_fr.dart
+++ b/lib/l10n/app_localizations_fr.dart
@@ -6930,9 +6930,18 @@ class AppLocalizationsFr extends AppLocalizations {
@override
String get androidAutoTabDownloads => 'Téléchargements';
+ @override
+ String get settingsSearchHint => 'Search settings...';
+
+ @override
+ String get settingsSearchNoResults => 'No matching settings';
+
@override
String get carConnectAutoplay => 'Start playback when Android Auto connects';
+ @override
+ String get carConnectAutoplayIos => 'Start playback when CarPlay connects';
+
@override
String get carConnectAutoplayOnSubtitle =>
'The last book you were listening to starts by itself when the car connects';
diff --git a/lib/l10n/app_localizations_it.dart b/lib/l10n/app_localizations_it.dart
index 4de4c95f..d0951abe 100644
--- a/lib/l10n/app_localizations_it.dart
+++ b/lib/l10n/app_localizations_it.dart
@@ -6883,9 +6883,18 @@ class AppLocalizationsIt extends AppLocalizations {
@override
String get androidAutoTabDownloads => 'Downloads';
+ @override
+ String get settingsSearchHint => 'Search settings...';
+
+ @override
+ String get settingsSearchNoResults => 'No matching settings';
+
@override
String get carConnectAutoplay => 'Start playback when Android Auto connects';
+ @override
+ String get carConnectAutoplayIos => 'Start playback when CarPlay connects';
+
@override
String get carConnectAutoplayOnSubtitle =>
'The last book you were listening to starts by itself when the car connects';
diff --git a/lib/l10n/app_localizations_ja.dart b/lib/l10n/app_localizations_ja.dart
index 8640fa03..2deb587c 100644
--- a/lib/l10n/app_localizations_ja.dart
+++ b/lib/l10n/app_localizations_ja.dart
@@ -6883,9 +6883,18 @@ class AppLocalizationsJa extends AppLocalizations {
@override
String get androidAutoTabDownloads => 'Downloads';
+ @override
+ String get settingsSearchHint => 'Search settings...';
+
+ @override
+ String get settingsSearchNoResults => 'No matching settings';
+
@override
String get carConnectAutoplay => 'Start playback when Android Auto connects';
+ @override
+ String get carConnectAutoplayIos => 'Start playback when CarPlay connects';
+
@override
String get carConnectAutoplayOnSubtitle =>
'The last book you were listening to starts by itself when the car connects';
diff --git a/lib/l10n/app_localizations_no.dart b/lib/l10n/app_localizations_no.dart
index e110286b..c5fe191b 100644
--- a/lib/l10n/app_localizations_no.dart
+++ b/lib/l10n/app_localizations_no.dart
@@ -6883,9 +6883,18 @@ class AppLocalizationsNo extends AppLocalizations {
@override
String get androidAutoTabDownloads => 'Downloads';
+ @override
+ String get settingsSearchHint => 'Search settings...';
+
+ @override
+ String get settingsSearchNoResults => 'No matching settings';
+
@override
String get carConnectAutoplay => 'Start playback when Android Auto connects';
+ @override
+ String get carConnectAutoplayIos => 'Start playback when CarPlay connects';
+
@override
String get carConnectAutoplayOnSubtitle =>
'The last book you were listening to starts by itself when the car connects';
diff --git a/lib/l10n/app_localizations_pt.dart b/lib/l10n/app_localizations_pt.dart
index 1e75759c..39634d20 100644
--- a/lib/l10n/app_localizations_pt.dart
+++ b/lib/l10n/app_localizations_pt.dart
@@ -6883,9 +6883,18 @@ class AppLocalizationsPt extends AppLocalizations {
@override
String get androidAutoTabDownloads => 'Downloads';
+ @override
+ String get settingsSearchHint => 'Search settings...';
+
+ @override
+ String get settingsSearchNoResults => 'No matching settings';
+
@override
String get carConnectAutoplay => 'Start playback when Android Auto connects';
+ @override
+ String get carConnectAutoplayIos => 'Start playback when CarPlay connects';
+
@override
String get carConnectAutoplayOnSubtitle =>
'The last book you were listening to starts by itself when the car connects';
diff --git a/lib/l10n/app_localizations_ro.dart b/lib/l10n/app_localizations_ro.dart
index 8b2594bd..26634908 100644
--- a/lib/l10n/app_localizations_ro.dart
+++ b/lib/l10n/app_localizations_ro.dart
@@ -6883,9 +6883,18 @@ class AppLocalizationsRo extends AppLocalizations {
@override
String get androidAutoTabDownloads => 'Downloads';
+ @override
+ String get settingsSearchHint => 'Search settings...';
+
+ @override
+ String get settingsSearchNoResults => 'No matching settings';
+
@override
String get carConnectAutoplay => 'Start playback when Android Auto connects';
+ @override
+ String get carConnectAutoplayIos => 'Start playback when CarPlay connects';
+
@override
String get carConnectAutoplayOnSubtitle =>
'The last book you were listening to starts by itself when the car connects';
diff --git a/lib/l10n/app_localizations_ru.dart b/lib/l10n/app_localizations_ru.dart
index e256cf10..40716445 100644
--- a/lib/l10n/app_localizations_ru.dart
+++ b/lib/l10n/app_localizations_ru.dart
@@ -6887,9 +6887,18 @@ class AppLocalizationsRu extends AppLocalizations {
@override
String get androidAutoTabDownloads => 'Downloads';
+ @override
+ String get settingsSearchHint => 'Search settings...';
+
+ @override
+ String get settingsSearchNoResults => 'No matching settings';
+
@override
String get carConnectAutoplay => 'Start playback when Android Auto connects';
+ @override
+ String get carConnectAutoplayIos => 'Start playback when CarPlay connects';
+
@override
String get carConnectAutoplayOnSubtitle =>
'The last book you were listening to starts by itself when the car connects';
diff --git a/lib/l10n/app_localizations_zh.dart b/lib/l10n/app_localizations_zh.dart
index 80fac1b2..95d14d5c 100644
--- a/lib/l10n/app_localizations_zh.dart
+++ b/lib/l10n/app_localizations_zh.dart
@@ -6793,9 +6793,18 @@ class AppLocalizationsZh extends AppLocalizations {
@override
String get androidAutoTabDownloads => 'Downloads';
+ @override
+ String get settingsSearchHint => 'Search settings...';
+
+ @override
+ String get settingsSearchNoResults => 'No matching settings';
+
@override
String get carConnectAutoplay => 'Start playback when Android Auto connects';
+ @override
+ String get carConnectAutoplayIos => 'Start playback when CarPlay connects';
+
@override
String get carConnectAutoplayOnSubtitle =>
'The last book you were listening to starts by itself when the car connects';
diff --git a/lib/screens/settings_screen.dart b/lib/screens/settings_screen.dart
index efbcac95..c4057d75 100644
--- a/lib/screens/settings_screen.dart
+++ b/lib/screens/settings_screen.dart
@@ -35,6 +35,8 @@ import '../screens/transcription_settings_screen.dart';
import '../main.dart' show applyThemeMode, applyTrustAllCerts, applyFlatBackground, applyColorSource, applyManualSeed, applyGradientIntensity, applyUseColorEverywhere, applyEinkModeTheme, applyOrientationLock, localeNotifier, flatNotifier, gradientIntensityNotifier, snappyTransitionsNotifier;
import '../services/wording.dart';
import '../utils/share_origin.dart';
+import '../widgets/settings_search.dart';
+import 'settings_search_index.dart';
import '../widgets/absorb_page_header.dart';
import '../widgets/theme_presets.dart';
import '../widgets/color_wheel_picker.dart';
@@ -201,6 +203,8 @@ class _SettingsScreenState extends State<SettingsScreen> {
String _appVersion = '';
String? _expandedSection;
final Map<String, GlobalKey> _sectionKeys = {};
+ final TextEditingController _settingsSearchController = TextEditingController();
+ String _settingsQuery = '';
GlobalKey _keyFor(String section) => _sectionKeys.putIfAbsent(section, () => GlobalKey());
@@ -285,9 +289,28 @@ class _SettingsScreenState extends State<SettingsScreen> {
_issueBadgeDebounce?.cancel();
PlayerSettings.settingsChanged.removeListener(_onExternalSettingsChange);
_localServerController.dispose();
+ _settingsSearchController.dispose();
super.dispose();
}
+ void _openSearchResult(SettingSearchEntry entry) {
+ FocusManager.instance.primaryFocus?.unfocus();
+ setState(() {
+ _settingsSearchController.clear();
+ _settingsQuery = '';
+ _expandedSection = entry.sectionId;
+ });
+ // The section list re-appears and the target section expands; once the
+ // expansion animation and the section-level auto-scroll have settled,
+ // locate the tile by its rendered title text and pulse it.
+ Future.delayed(const Duration(milliseconds: 700), () {
+ if (!mounted) return;
+ final ctx = _keyFor(entry.sectionId).currentContext;
+ if (ctx == null) return;
+ highlightSettingInSection(sectionContext: ctx, title: entry.title);
+ });
+ }
+
void _onExternalSettingsChange() async {
final bookMode = await PlayerSettings.getBookQueueMode();
final podMode = await PlayerSettings.getPodcastQueueMode();
@@ -1479,6 +1502,46 @@ class _SettingsScreenState extends State<SettingsScreen> {
padding: const EdgeInsets.fromLTRB(20, 12, 20, 8),
),
),
+ SliverToBoxAdapter(
+ child: Padding(
+ padding: const EdgeInsets.fromLTRB(16, 0, 16, 4),
+ child: Container(
+ height: 44,
+ decoration: BoxDecoration(
+ color: cs.surfaceContainerHigh,
+ borderRadius: BorderRadius.circular(22),
+ ),
+ child: Row(children: [
+ const SizedBox(width: 14),
+ Icon(Icons.search_rounded, size: 20, color: cs.onSurfaceVariant),
+ const SizedBox(width: 8),
+ Expanded(
+ child: TextField(
+ controller: _settingsSearchController,
+ onChanged: (v) => setState(() => _settingsQuery = v),
+ decoration: InputDecoration(
+ hintText: l.settingsSearchHint,
+ border: InputBorder.none,
+ isDense: true,
+ ),
+ style: tt.bodyMedium,
+ ),
+ ),
+ if (_settingsQuery.isNotEmpty)
+ IconButton(
+ icon: const Icon(Icons.close_rounded, size: 18),
+ color: cs.onSurfaceVariant,
+ onPressed: () => setState(() {
+ _settingsSearchController.clear();
+ _settingsQuery = '';
+ }),
+ ),
+ const SizedBox(width: 4),
+ ]),
+ ),
+ ),
+ ),
+ if (_settingsQuery.trim().isEmpty)
SliverToBoxAdapter(
child: Column(
children: [
@@ -2839,6 +2902,22 @@ class _SettingsScreenState extends State<SettingsScreen> {
PlayerSettings.setLockSeekBar(v);
} : null,
),
+ const Divider(height: 1, indent: 16, endIndent: 16),
+ SwitchListTile(
+ title: Text(Platform.isIOS
+ ? l.carConnectAutoplayIos
+ : l.carConnectAutoplay),
+ subtitle: Text(
+ _autoplayOnCarConnect
+ ? l.carConnectAutoplayOnSubtitle
+ : l.carConnectAutoplayOffSubtitle,
+ style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant)),
+ value: _autoplayOnCarConnect,
+ onChanged: _loaded ? (v) {
+ setState(() => _autoplayOnCarConnect = v);
+ PlayerSettings.setAutoplayOnCarConnect(v);
+ } : null,
+ ),
// Android only: chooses which pair fills the phone media
// player's two extra slots. iOS uses CarPlay's own buttons.
if (Platform.isAndroid) ...[
@@ -2857,20 +2936,6 @@ class _SettingsScreenState extends State<SettingsScreen> {
} : null,
),
const Divider(height: 1, indent: 16, endIndent: 16),
- SwitchListTile(
- title: Text(l.carConnectAutoplay),
- subtitle: Text(
- _autoplayOnCarConnect
- ? l.carConnectAutoplayOnSubtitle
- : l.carConnectAutoplayOffSubtitle,
- style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant)),
- value: _autoplayOnCarConnect,
- onChanged: _loaded ? (v) {
- setState(() => _autoplayOnCarConnect = v);
- PlayerSettings.setAutoplayOnCarConnect(v);
- } : null,
- ),
- const Divider(height: 1, indent: 16, endIndent: 16),
SwitchListTile(
title: Text(l.speedBookmarkInControls),
subtitle: Text(
@@ -4149,7 +4214,15 @@ class _SettingsScreenState extends State<SettingsScreen> {
const SizedBox(height: 100),
],
),
- ),
+ )
+ else
+ SliverToBoxAdapter(
+ child: SettingsSearchResults(
+ results: filterSettingEntries(
+ settingsSearchEntries(context), _settingsQuery),
+ onOpen: _openSearchResult,
+ ),
+ ),
],
),
),
diff --git a/lib/screens/settings_search_index.dart b/lib/screens/settings_search_index.dart
new file mode 100644
index 00000000..1b419bba
--- /dev/null
+++ b/lib/screens/settings_search_index.dart
@@ -0,0 +1,148 @@
+import 'dart:io' show Platform;
+import 'package:flutter/widgets.dart';
+import '../l10n/app_localizations.dart';
+import '../services/wording.dart';
+
+class SettingSearchEntry {
+ final String sectionId; // exact string passed to _keyFor(...)
+ final String sectionTitle; // localized section display name
+ final String title; // tile title as rendered
+ final List<String> extras; // subtitle variants / description strings
+ const SettingSearchEntry(this.sectionId, this.sectionTitle, this.title, this.extras);
+}
+
+List<SettingSearchEntry> settingsSearchEntries(BuildContext context) {
+ final l = AppLocalizations.of(context)!;
+ final w = Wording.of(context);
+ return [
+ // ── Appearance ──
+ SettingSearchEntry('Appearance', l.sectionAppearance, l.languageLabel, [l.languageSystemDefault]),
+ SettingSearchEntry('Appearance', l.sectionAppearance, l.themeLabel, [l.themeDark, l.themeLight, l.themeAuto]),
+ SettingSearchEntry('Appearance', l.sectionAppearance, l.flatBackgroundLabel, [l.flatBackgroundSubtitle]),
+ SettingSearchEntry('Appearance', l.sectionAppearance, l.einkModeLabel, [l.einkModeSubtitle]),
+ SettingSearchEntry('Appearance', l.sectionAppearance, l.backgroundIntensityLabel, const []),
+ SettingSearchEntry('Appearance', l.sectionAppearance, l.colorSourceLabel, [l.colorSourceDynamic, l.colorSourceManual, l.colorSourceManualDescription, l.colorSourceCoverDescription, l.colorSourceCustom]),
+ SettingSearchEntry('Appearance', l.sectionAppearance, l.useColorEverywhereLabel, [l.useColorEverywhereSubtitle]),
+ SettingSearchEntry('Appearance', l.sectionAppearance, l.startScreenLabel, [l.startScreenSubtitle, l.startScreenHome, l.startScreenLibrary, w.startScreenAbsorb, l.startScreenStats]),
+ SettingSearchEntry('Appearance', l.sectionAppearance, l.progressTextSize, const []),
+ SettingSearchEntry('Appearance', l.sectionAppearance, l.disablePageFade, [l.disablePageFadeOnSubtitle, l.disablePageFadeOffSubtitle]),
+ SettingSearchEntry('Appearance', l.sectionAppearance, l.rectangleBookCovers, [l.rectangleBookCoversOnSubtitle, l.rectangleBookCoversOffSubtitle]),
+ SettingSearchEntry('Appearance', l.sectionAppearance, l.coverSize, [l.coverSizeSubtitle, l.coverSizeSmall, l.coverSizeMedium, l.coverSizeLarge]),
+ SettingSearchEntry('Appearance', l.sectionAppearance, 'Classic wording', const ['Using "Play", "Now Playing", "Finished"', 'Using "Absorb", "Absorbing", "Fully Absorbed"']),
+ if (!(Platform.isIOS && MediaQuery.sizeOf(context).shortestSide >= 600))
+ SettingSearchEntry('Appearance', l.sectionAppearance, 'Lock rotation', const ['Screen stays in portrait', 'Screen can rotate with the device']),
+
+ // ── Customize Stats ──
+ SettingSearchEntry('Customize Stats', l.settingsCustomizeStats, l.statsGoalTitle, [l.statsGoalDaily, l.statsGoalWeekly, l.statsGoalMonthly, l.statsGoalOff]),
+ SettingSearchEntry('Customize Stats', l.settingsCustomizeStats, l.statsWeekStartsOn, [l.absorbingSharedSunday, l.absorbingSharedMonday, l.absorbingSharedSaturday]),
+ SettingSearchEntry('Customize Stats', l.settingsCustomizeStats, l.statsBookChallengeTitle, [l.statsBookChallengeDesc]),
+ SettingSearchEntry('Customize Stats', l.settingsCustomizeStats, l.statsChartTitle, [l.statsChartBar, l.statsChartLine, l.statsChartDays7, l.statsChartDays30]),
+ SettingSearchEntry('Customize Stats', l.settingsCustomizeStats, l.statsSectionsTitle, [l.dragToReorderTapEye]),
+
+ // ── Absorbing Cards ──
+ SettingSearchEntry('Absorbing Cards', w.sectionAbsorbingCards, l.fullScreenPlayer, [l.fullScreenPlayerOnSubtitle, l.fullScreenPlayerOffSubtitle]),
+ SettingSearchEntry('Absorbing Cards', w.sectionAbsorbingCards, l.coverPlayPause, [l.coverPlayPauseOnSubtitle, l.coverPlayPauseOffSubtitle]),
+ SettingSearchEntry('Absorbing Cards', w.sectionAbsorbingCards, l.cardBackground, [l.cardBackgroundBlurred, l.cardBackgroundGradient, l.off]),
+ SettingSearchEntry('Absorbing Cards', w.sectionAbsorbingCards, l.cardScrubbers, [l.cardScrubbersBothSubtitle, l.cardScrubbersChapterSubtitle, l.cardScrubbersLockedSubtitle]),
+ SettingSearchEntry('Absorbing Cards', w.sectionAbsorbingCards, l.speedAdjustedTime, [l.speedAdjustedTimeOnSubtitle, l.speedAdjustedTimeOffSubtitle]),
+ SettingSearchEntry('Absorbing Cards', w.sectionAbsorbingCards, w.mergeLibraries, [w.mergeLibrariesOnSubtitle, w.mergeLibrariesOffSubtitle, l.settingsMergeImpliedByPodcastTab]),
+ SettingSearchEntry('Absorbing Cards', w.sectionAbsorbingCards, l.queueMode, [l.queueModeMergedSubtitle, l.queueModeBooks, l.queueModePodcasts, l.queueModeOff, l.queueModeManual, l.queueModeAuto, l.queueModeSeriesLabel, l.queueModeShowLabel, l.queueModePlaylist]),
+ SettingSearchEntry('Absorbing Cards', w.sectionAbsorbingCards, l.autoDownloadQueue, [l.autoDownloadQueueOffSubtitle]),
+ SettingSearchEntry('Absorbing Cards', w.sectionAbsorbingCards, l.resetButtonGrid, const []),
+
+ // ── Playback ──
+ SettingSearchEntry('Playback', l.sectionPlayback, l.defaultSpeed, [l.defaultSpeedSubtitle]),
+ SettingSearchEntry('Playback', l.sectionPlayback, l.resetSpeedPresets, [l.resetSpeedPresetsSubtitle]),
+ SettingSearchEntry('Playback', l.sectionPlayback, l.skipBack, const []),
+ SettingSearchEntry('Playback', l.sectionPlayback, l.skipForward, const []),
+ SettingSearchEntry('Playback', l.sectionPlayback, l.chapterBarrierOnRewind, [l.chapterBarrierOnRewindOnSubtitle, l.chapterBarrierOnRewindOffSubtitle]),
+ SettingSearchEntry('Playback', l.sectionPlayback, l.longSkipButtons, [l.longSkipButtonsOnSubtitle, l.longSkipButtonsOffSubtitle]),
+ SettingSearchEntry('Playback', l.sectionPlayback, l.longSkipBack, const []),
+ SettingSearchEntry('Playback', l.sectionPlayback, l.longSkipForward, const []),
+ SettingSearchEntry('Playback', l.sectionPlayback, l.autoRewindOnResume, [l.autoRewindOffSubtitle]),
+ SettingSearchEntry('Playback', l.sectionPlayback, l.rewindRange, const []),
+ SettingSearchEntry('Playback', l.sectionPlayback, l.rewindAfterPausedFor, [l.rewindAnyPause, l.rewindAlwaysDescription]),
+ SettingSearchEntry('Playback', l.sectionPlayback, l.chapterBarrier, [l.chapterBarrierSubtitle]),
+ SettingSearchEntry('Playback', l.sectionPlayback, l.rewindOnSessionStart, [l.autoRewindOffSubtitle]),
+
+ // ── Media Controls ──
+ SettingSearchEntry('Media Controls', l.sectionMediaControls, l.chapterProgressInNotification, [l.chapterProgressInNotificationIos, l.chapterProgressOnSubtitle, l.chapterProgressOnSubtitleIos, l.chapterProgressOffSubtitle]),
+ SettingSearchEntry('Media Controls', l.sectionMediaControls, l.lockSeekBar, [l.lockSeekBarOnSubtitle, l.lockSeekBarOffSubtitle]),
+ SettingSearchEntry(
+ 'Media Controls',
+ l.sectionMediaControls,
+ Platform.isIOS ? l.carConnectAutoplayIos : l.carConnectAutoplay,
+ [l.carConnectAutoplayOnSubtitle, l.carConnectAutoplayOffSubtitle]),
+ if (Platform.isAndroid) ...[
+ SettingSearchEntry('Media Controls', l.sectionMediaControls, 'Duck brief interruptions', const ['Notifications and prompts lower the volume instead of pausing', 'Notifications and prompts pause playback']),
+ SettingSearchEntry('Media Controls', l.sectionMediaControls, l.speedBookmarkInControls, [l.speedBookmarkOnSubtitle, l.speedBookmarkOffSubtitle]),
+ ],
+
+ // ── Sleep Timer ──
+ SettingSearchEntry('Sleep Timer', l.sectionSleepTimer, l.shakeDuringSleepTimer, [l.shakeOff, l.shakeAddTime, l.shakeReset]),
+ SettingSearchEntry('Sleep Timer', l.sectionSleepTimer, l.shakeSensitivity, [l.shakeSensitivityVeryLow, l.shakeSensitivityLow, l.shakeSensitivityMedium, l.shakeSensitivityHigh, l.shakeSensitivityVeryHigh]),
+ SettingSearchEntry('Sleep Timer', l.sectionSleepTimer, l.buttonDuringSleepTimer, [l.shakeOff, l.shakeAddTime, l.shakeReset, l.buttonDuringSleepTimerHint]),
+ SettingSearchEntry('Sleep Timer', l.sectionSleepTimer, l.sleepAddAmount, const []),
+ SettingSearchEntry('Sleep Timer', l.sectionSleepTimer, l.resetTimerOnPause, [l.resetTimerOnPauseOnSubtitle, l.resetTimerOnPauseOffSubtitle]),
+ SettingSearchEntry('Sleep Timer', l.sectionSleepTimer, l.sleepTimerSheetRewindOnSleep, const []),
+ SettingSearchEntry('Sleep Timer', l.sectionSleepTimer, l.fadeVolumeBeforeSleep, [l.fadeVolumeOffSubtitle]),
+ SettingSearchEntry('Sleep Timer', l.sectionSleepTimer, l.chimeBeforeSleep, [l.chimeBeforeSleepOnSubtitle, l.chimeBeforeSleepOffSubtitle]),
+ SettingSearchEntry('Sleep Timer', l.sectionSleepTimer, l.windDownDuration, const []),
+ SettingSearchEntry('Sleep Timer', l.sectionSleepTimer, l.autoSleepTimer, [l.autoSleepTimerOffSubtitle]),
+ SettingSearchEntry('Sleep Timer', l.sectionSleepTimer, l.windowStart, const []),
+ SettingSearchEntry('Sleep Timer', l.sectionSleepTimer, l.windowEnd, const []),
+ SettingSearchEntry('Sleep Timer', l.sectionSleepTimer, l.endOfChapterShort, [l.endOfChapterOnSubtitle, l.endOfChapterOffSubtitle]),
+ SettingSearchEntry('Sleep Timer', l.sectionSleepTimer, l.timerDuration, const []),
+
+ // ── Downloads & Storage ──
+ SettingSearchEntry('Downloads & Storage', l.sectionDownloadsAndStorage, l.downloadOverWifiOnly, [l.downloadOverWifiOnSubtitle, l.downloadOverWifiOffSubtitle]),
+ SettingSearchEntry('Downloads & Storage', l.sectionDownloadsAndStorage, l.autoDownloadOnWifi, [l.autoDownloadOnWifiOnSubtitle, l.autoDownloadOnWifiOffSubtitle]),
+ SettingSearchEntry('Downloads & Storage', l.sectionDownloadsAndStorage, 'Auto-download series', const ['Starting a book in a series keeps the next books downloaded', 'Turn on series downloads yourself from the series menu']),
+ SettingSearchEntry('Downloads & Storage', l.sectionDownloadsAndStorage, l.concurrentDownloads, const []),
+ SettingSearchEntry('Downloads & Storage', l.sectionDownloadsAndStorage, l.autoDownload, [l.autoDownloadSubtitle]),
+ SettingSearchEntry('Downloads & Storage', l.sectionDownloadsAndStorage, l.keepNext, const []),
+ SettingSearchEntry('Downloads & Storage', l.sectionDownloadsAndStorage, w.deleteAbsorbedDownloads, [l.deleteAbsorbedOnSubtitle, l.deleteAbsorbedOffSubtitle]),
+ if (!Platform.isIOS)
+ SettingSearchEntry('Downloads & Storage', l.sectionDownloadsAndStorage, l.downloadLocation, const []),
+ SettingSearchEntry('Downloads & Storage', l.sectionDownloadsAndStorage, l.manageDownloads, const []),
+ SettingSearchEntry('Downloads & Storage', l.sectionDownloadsAndStorage, l.streamingCache, [l.streamingCacheOffSubtitle, l.streamingCacheOff, l.clearCache]),
+
+ // ── Library ──
+ SettingSearchEntry('Library', l.sectionLibrary, l.settingsPodcastTab, [l.settingsPodcastTabDesc]),
+ SettingSearchEntry('Library', l.sectionLibrary, l.settingsPodcastTabLibrary, const []),
+ SettingSearchEntry('Library', l.sectionLibrary, l.hideEbookOnlyTitles, [l.hideEbookOnlyOnSubtitle, l.hideEbookOnlyOffSubtitle]),
+ SettingSearchEntry('Library', l.sectionLibrary, l.showGoodreadsButton, [l.showGoodreadsOnSubtitle, l.showGoodreadsOffSubtitle]),
+ SettingSearchEntry('Library', l.sectionLibrary, l.showExplicitBadge, [l.showExplicitBadgeOnSubtitle, l.showExplicitBadgeOffSubtitle]),
+ SettingSearchEntry('Library', l.sectionLibrary, l.coverShapeLabel, [l.coverShapeDefault, l.coverShapeSquare, l.coverShapeRectangle]),
+ SettingSearchEntry('Library', l.sectionLibrary, l.currentLibrarySkipOverride, [l.currentLibrarySkipOverrideOnSubtitle, l.currentLibrarySkipOverrideOffSubtitle]),
+ SettingSearchEntry('Library', l.sectionLibrary, l.currentLibrarySkipBack, const []),
+ SettingSearchEntry('Library', l.sectionLibrary, l.currentLibrarySkipForward, const []),
+
+ // ── Permissions ──
+ SettingSearchEntry('Permissions', l.sectionPermissions, l.notifications, [l.notificationsSubtitle]),
+ if (Platform.isAndroid) ...[
+ SettingSearchEntry('Permissions', l.sectionPermissions, l.settingsEpisodeNotifs, [l.settingsEpisodeNotifsDesc]),
+ SettingSearchEntry('Permissions', l.sectionPermissions, l.unrestrictedBattery, [l.unrestrictedBatterySubtitle]),
+ ],
+
+ // ── Issues & Support ──
+ SettingSearchEntry('Issues & Support', l.sectionIssuesAndSupport, l.showTipsAgain, [l.showTipsAgainSubtitle]),
+ SettingSearchEntry('Issues & Support', l.sectionIssuesAndSupport, l.bugsAndFeatureRequests, [l.bugsAndFeatureRequestsSubtitle]),
+ SettingSearchEntry('Issues & Support', l.sectionIssuesAndSupport, l.joinDiscord, [l.joinDiscordSubtitle]),
+ SettingSearchEntry('Issues & Support', l.sectionIssuesAndSupport, l.contact, [l.contactSubtitle]),
+ SettingSearchEntry('Issues & Support', l.sectionIssuesAndSupport, l.enableLogging, [l.enableLoggingOnSubtitle, l.enableLoggingOffSubtitle]),
+ SettingSearchEntry('Issues & Support', l.sectionIssuesAndSupport, l.sendLogs, [l.sendLogsSubtitle]),
+ SettingSearchEntry('Issues & Support', l.sectionIssuesAndSupport, l.clearLogs, const []),
+
+ // ── Advanced ──
+ SettingSearchEntry('Advanced', l.sectionAdvanced, l.navHoldSettingTitle, [l.navHoldSettingSubtitle]),
+ SettingSearchEntry('Advanced', l.sectionAdvanced, l.localServer, [l.localServerOnConnectedSubtitle, l.localServerOnRemoteSubtitle, l.localServerOffSubtitle, l.localServerUrlLabel]),
+ SettingSearchEntry('Advanced', l.sectionAdvanced, l.trustAllCertificates, [l.trustAllCertificatesOnSubtitle, l.trustAllCertificatesOffSubtitle]),
+ if (Platform.isAndroid)
+ SettingSearchEntry('Advanced', l.sectionAdvanced, l.mp3IndexSeeking, [l.mp3IndexSeekingOnSubtitle, l.mp3IndexSeekingOffSubtitle]),
+ if (const bool.fromEnvironment('GITHUB_BUILD'))
+ SettingSearchEntry('Advanced', l.sectionAdvanced, l.includePreReleases, [l.includePreReleasesOnSubtitle, l.includePreReleasesOffSubtitle]),
+ SettingSearchEntry('Advanced', l.sectionAdvanced, l.adminRmab, [l.adminRmabConnected, l.adminRmabAskAdmin]),
+ SettingSearchEntry('Advanced', l.sectionAdvanced, l.transcriptionTitle, [l.transcriptionAdvancedSubtitle]),
+ ];
+}
diff --git a/lib/widgets/settings_search.dart b/lib/widgets/settings_search.dart
new file mode 100644
index 00000000..8105a906
--- /dev/null
+++ b/lib/widgets/settings_search.dart
@@ -0,0 +1,212 @@
+import 'package:flutter/material.dart';
+
+import '../l10n/app_localizations.dart';
+import '../screens/settings_search_index.dart';
+import 'collapsible_section.dart';
+
+/// Filter and rank the search index for [query]. Every whitespace-separated
+/// word must appear somewhere in the entry (title, subtitles, or section
+/// name); entries whose title matches rank above subtitle-only matches.
+List<SettingSearchEntry> filterSettingEntries(
+ List<SettingSearchEntry> entries,
+ String query,
+) {
+ final words = query.toLowerCase().split(RegExp(r'\s+'))
+ ..removeWhere((w) => w.isEmpty);
+ if (words.isEmpty) return const [];
+
+ int rankOf(SettingSearchEntry e) {
+ final title = e.title.toLowerCase();
+ final extras = e.extras.map((s) => s.toLowerCase()).toList();
+ final section = e.sectionTitle.toLowerCase();
+ var best = 4;
+ for (final w in words) {
+ final int r;
+ if (title.startsWith(w)) {
+ r = 0;
+ } else if (title.contains(w)) {
+ r = 1;
+ } else if (extras.any((s) => s.contains(w))) {
+ r = 2;
+ } else if (section.contains(w)) {
+ r = 3;
+ } else {
+ return -1; // word not found anywhere - entry is out
+ }
+ if (r < best) best = r;
+ }
+ return best;
+ }
+
+ final ranked = <(int, int, SettingSearchEntry)>[];
+ for (var i = 0; i < entries.length; i++) {
+ final r = rankOf(entries[i]);
+ if (r >= 0) ranked.add((r, i, entries[i]));
+ }
+ ranked.sort((a, b) {
+ if (a.$1 != b.$1) return a.$1.compareTo(b.$1);
+ return a.$2.compareTo(b.$2); // stable: keep on-screen order within a rank
+ });
+ return ranked.map((e) => e.$3).toList();
+}
+
+class SettingsSearchResults extends StatelessWidget {
+ final List<SettingSearchEntry> results;
+ final void Function(SettingSearchEntry) onOpen;
+ const SettingsSearchResults({
+ super.key,
+ required this.results,
+ required this.onOpen,
+ });
+
+ @override
+ Widget build(BuildContext context) {
+ final cs = Theme.of(context).colorScheme;
+ final tt = Theme.of(context).textTheme;
+ final l = AppLocalizations.of(context)!;
+ if (results.isEmpty) {
+ return Padding(
+ padding: const EdgeInsets.symmetric(vertical: 48),
+ child: Center(
+ child: Text(l.settingsSearchNoResults,
+ style: tt.bodyMedium?.copyWith(color: cs.onSurfaceVariant)),
+ ),
+ );
+ }
+ return Column(
+ children: [
+ for (final e in results)
+ ListTile(
+ dense: true,
+ title: Text(e.title, maxLines: 1, overflow: TextOverflow.ellipsis),
+ subtitle: e.extras.isEmpty
+ ? Text(e.sectionTitle,
+ style: tt.bodySmall?.copyWith(color: cs.primary))
+ : Text.rich(
+ TextSpan(children: [
+ TextSpan(
+ text: '${e.sectionTitle} · ',
+ style: TextStyle(color: cs.primary)),
+ TextSpan(text: e.extras.first),
+ ]),
+ maxLines: 2,
+ overflow: TextOverflow.ellipsis,
+ style: tt.bodySmall
+ ?.copyWith(color: cs.onSurfaceVariant),
+ ),
+ trailing: Icon(Icons.chevron_right_rounded,
+ size: 18, color: cs.onSurfaceVariant.withValues(alpha: 0.5)),
+ onTap: () => onOpen(e),
+ ),
+ ],
+ );
+ }
+}
+
+/// Scroll the tile whose title text is [title] into view inside the expanded
+/// section at [sectionContext], then pulse a highlight over it. The tile is
+/// located by its rendered title text, so the 150+ settings tiles need no
+/// individual markers. No-op if the text isn't found (e.g. the tile is
+/// hidden behind a feature flag).
+Future<void> highlightSettingInSection({
+ required BuildContext sectionContext,
+ required String title,
+}) async {
+ Element? found;
+ void visit(Element e) {
+ if (found != null) return;
+ final w = e.widget;
+ if (w is Text && w.data == title) {
+ found = e;
+ return;
+ }
+ e.visitChildren(visit);
+ }
+
+ (sectionContext as Element).visitChildren(visit);
+ final textElement = found;
+ if (textElement == null || !textElement.mounted) return;
+
+ await Scrollable.ensureVisible(
+ textElement,
+ duration: const Duration(milliseconds: 250),
+ curve: Curves.easeOut,
+ alignment: 0.35,
+ );
+ // Measuring immediately catches the section's expand animation mid-flight
+ // and paints the pulse where the row used to be - let the layout settle.
+ await Future.delayed(const Duration(milliseconds: 200));
+ if (!textElement.mounted) return;
+
+ // Prefer the enclosing tile's bounds over the bare text so the pulse
+ // covers the whole row, toggle included.
+ RenderObject? target = textElement.renderObject;
+ var tileFound = false;
+ textElement.visitAncestorElements((a) {
+ final w = a.widget;
+ if (w is SwitchListTile ||
+ w is ListTile ||
+ w is CheckboxListTile ||
+ w is RadioListTile) {
+ target = a.renderObject ?? target;
+ tileFound = true;
+ return false;
+ }
+ // Stop climbing once we leave the section - keeps a missing tile
+ // ancestor from selecting something huge.
+ return w is! CollapsibleSection;
+ });
+ final box = target;
+ if (box is! RenderBox || !box.attached) return;
+ var rect = box.localToGlobal(Offset.zero) & box.size;
+ if (!tileFound) {
+ // Custom rows (segmented pickers, sliders) have no ListTile ancestor -
+ // the pulse would hug the bare title text. Span the section's width at
+ // the title's line instead so it still reads as "this row".
+ final section = sectionContext.findRenderObject();
+ if (section is RenderBox && section.attached) {
+ final s = section.localToGlobal(Offset.zero) & section.size;
+ rect = Rect.fromLTRB(s.left + 8, rect.top - 10, s.right - 8, rect.bottom + 10);
+ } else {
+ rect = rect.inflate(10);
+ }
+ }
+ rect = rect.inflate(2);
+
+ final overlay = Overlay.maybeOf(sectionContext);
+ if (overlay == null) return;
+ final accent = Theme.of(sectionContext).colorScheme.primary;
+ late OverlayEntry entry;
+ entry = OverlayEntry(
+ builder: (_) => Positioned.fromRect(
+ rect: rect,
+ child: IgnorePointer(
+ child: TweenAnimationBuilder<double>(
+ tween: Tween(begin: 0, end: 1),
+ duration: const Duration(milliseconds: 1800),
+ onEnd: () => entry.remove(),
+ builder: (_, t, __) {
+ // Quick fade in, hold, slow fade out.
+ final opacity = t < 0.12
+ ? t / 0.12
+ : t > 0.55
+ ? ((1 - t) / 0.45).clamp(0.0, 1.0)
+ : 1.0;
+ return Opacity(
+ opacity: opacity,
+ child: Container(
+ decoration: BoxDecoration(
+ color: accent.withValues(alpha: 0.14),
+ borderRadius: BorderRadius.circular(12),
+ border: Border.all(
+ color: accent.withValues(alpha: 0.55), width: 1.5),
+ ),
+ ),
+ );
+ },
+ ),
+ ),
+ ),
+ );
+ overlay.insert(entry);
+}