A cross platform Audiobookshelf client for Android and iOS
Dart
Add a setting to show book subtitles in the library and on home, and always show them on the book details sheet
Barnabas63c291da4554
diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arbindex fb75efdd..09b9b0b9 100644--- a/lib/l10n/app_en.arb+++ b/lib/l10n/app_en.arb@@ -759,6 +759,13 @@"coverShapeSquare": "Square","coverShapeRectangle": "Rectangle","coverShapeLabel": "Cover shape",+ "showSubtitles": "Show subtitles",+ "showSubtitlesOnSubtitle": "Subtitles show under book titles in the library and on home",+ "showSubtitlesOffSubtitle": "Off - subtitles only on the book details sheet",+ "subtitleVisibilityLabel": "Subtitles",+ "subtitleVisibilityDefault": "Default",+ "subtitleVisibilityShow": "Show",+ "subtitleVisibilityHide": "Hide","currentLibrarySettingsTitle": "Current library: {name}","@currentLibrarySettingsTitle": {"placeholders": { "name": { "type": "String" } }diff --git a/lib/l10n/app_localizations.dart b/lib/l10n/app_localizations.dartindex 8b793a90..7f7bdbb3 100644--- a/lib/l10n/app_localizations.dart+++ b/lib/l10n/app_localizations.dart@@ -3058,6 +3058,48 @@ abstract class AppLocalizations {/// **'Cover shape'**String get coverShapeLabel;+ /// No description provided for @showSubtitles.+ ///+ /// In en, this message translates to:+ /// **'Show subtitles'**+ String get showSubtitles;++ /// No description provided for @showSubtitlesOnSubtitle.+ ///+ /// In en, this message translates to:+ /// **'Subtitles show under book titles in the library and on home'**+ String get showSubtitlesOnSubtitle;++ /// No description provided for @showSubtitlesOffSubtitle.+ ///+ /// In en, this message translates to:+ /// **'Off - subtitles only on the book details sheet'**+ String get showSubtitlesOffSubtitle;++ /// No description provided for @subtitleVisibilityLabel.+ ///+ /// In en, this message translates to:+ /// **'Subtitles'**+ String get subtitleVisibilityLabel;++ /// No description provided for @subtitleVisibilityDefault.+ ///+ /// In en, this message translates to:+ /// **'Default'**+ String get subtitleVisibilityDefault;++ /// No description provided for @subtitleVisibilityShow.+ ///+ /// In en, this message translates to:+ /// **'Show'**+ String get subtitleVisibilityShow;++ /// No description provided for @subtitleVisibilityHide.+ ///+ /// In en, this message translates to:+ /// **'Hide'**+ String get subtitleVisibilityHide;+/// No description provided for @currentLibrarySettingsTitle.////// In en, this message translates to:diff --git a/lib/l10n/app_localizations_de.dart b/lib/l10n/app_localizations_de.dartindex 18dfd29f..696f2b76 100644--- a/lib/l10n/app_localizations_de.dart+++ b/lib/l10n/app_localizations_de.dart@@ -1635,6 +1635,29 @@ class AppLocalizationsDe extends AppLocalizations {@overrideString get coverShapeLabel => 'Cover Format';+ @override+ String get showSubtitles => 'Show subtitles';++ @override+ String get showSubtitlesOnSubtitle =>+ 'Subtitles show under book titles in the library and on home';++ @override+ String get showSubtitlesOffSubtitle =>+ 'Off - subtitles only on the book details sheet';++ @override+ String get subtitleVisibilityLabel => 'Subtitles';++ @override+ String get subtitleVisibilityDefault => 'Default';++ @override+ String get subtitleVisibilityShow => 'Show';++ @override+ String get subtitleVisibilityHide => 'Hide';+@overrideString currentLibrarySettingsTitle(String name) {return 'Aktuelle Bibliothek: $name';diff --git a/lib/l10n/app_localizations_el.dart b/lib/l10n/app_localizations_el.dartindex f0c5badc..2f26a5ee 100644--- a/lib/l10n/app_localizations_el.dart+++ b/lib/l10n/app_localizations_el.dart@@ -1620,6 +1620,29 @@ class AppLocalizationsEl extends AppLocalizations {@overrideString get coverShapeLabel => 'Cover shape';+ @override+ String get showSubtitles => 'Show subtitles';++ @override+ String get showSubtitlesOnSubtitle =>+ 'Subtitles show under book titles in the library and on home';++ @override+ String get showSubtitlesOffSubtitle =>+ 'Off - subtitles only on the book details sheet';++ @override+ String get subtitleVisibilityLabel => 'Subtitles';++ @override+ String get subtitleVisibilityDefault => 'Default';++ @override+ String get subtitleVisibilityShow => 'Show';++ @override+ String get subtitleVisibilityHide => 'Hide';+@overrideString currentLibrarySettingsTitle(String name) {return 'Current library: $name';diff --git a/lib/l10n/app_localizations_en.dart b/lib/l10n/app_localizations_en.dartindex 6740cdaa..90836152 100644--- a/lib/l10n/app_localizations_en.dart+++ b/lib/l10n/app_localizations_en.dart@@ -1620,6 +1620,29 @@ class AppLocalizationsEn extends AppLocalizations {@overrideString get coverShapeLabel => 'Cover shape';+ @override+ String get showSubtitles => 'Show subtitles';++ @override+ String get showSubtitlesOnSubtitle =>+ 'Subtitles show under book titles in the library and on home';++ @override+ String get showSubtitlesOffSubtitle =>+ 'Off - subtitles only on the book details sheet';++ @override+ String get subtitleVisibilityLabel => 'Subtitles';++ @override+ String get subtitleVisibilityDefault => 'Default';++ @override+ String get subtitleVisibilityShow => 'Show';++ @override+ String get subtitleVisibilityHide => 'Hide';+@overrideString currentLibrarySettingsTitle(String name) {return 'Current library: $name';diff --git a/lib/l10n/app_localizations_es.dart b/lib/l10n/app_localizations_es.dartindex d597739b..21914c99 100644--- a/lib/l10n/app_localizations_es.dart+++ b/lib/l10n/app_localizations_es.dart@@ -1622,6 +1622,29 @@ class AppLocalizationsEs extends AppLocalizations {@overrideString get coverShapeLabel => 'Cover shape';+ @override+ String get showSubtitles => 'Show subtitles';++ @override+ String get showSubtitlesOnSubtitle =>+ 'Subtitles show under book titles in the library and on home';++ @override+ String get showSubtitlesOffSubtitle =>+ 'Off - subtitles only on the book details sheet';++ @override+ String get subtitleVisibilityLabel => 'Subtitles';++ @override+ String get subtitleVisibilityDefault => 'Default';++ @override+ String get subtitleVisibilityShow => 'Show';++ @override+ String get subtitleVisibilityHide => 'Hide';+@overrideString currentLibrarySettingsTitle(String name) {return 'Current library: $name';diff --git a/lib/l10n/app_localizations_fr.dart b/lib/l10n/app_localizations_fr.dartindex dc7b1fb2..7128f4e5 100644--- a/lib/l10n/app_localizations_fr.dart+++ b/lib/l10n/app_localizations_fr.dart@@ -1643,6 +1643,29 @@ class AppLocalizationsFr extends AppLocalizations {@overrideString get coverShapeLabel => 'Forme de couverture';+ @override+ String get showSubtitles => 'Show subtitles';++ @override+ String get showSubtitlesOnSubtitle =>+ 'Subtitles show under book titles in the library and on home';++ @override+ String get showSubtitlesOffSubtitle =>+ 'Off - subtitles only on the book details sheet';++ @override+ String get subtitleVisibilityLabel => 'Subtitles';++ @override+ String get subtitleVisibilityDefault => 'Default';++ @override+ String get subtitleVisibilityShow => 'Show';++ @override+ String get subtitleVisibilityHide => 'Hide';+@overrideString currentLibrarySettingsTitle(String name) {return 'Bibliothèque actuelle : $name';diff --git a/lib/l10n/app_localizations_it.dart b/lib/l10n/app_localizations_it.dartindex 04ee2754..abb13cdb 100644--- a/lib/l10n/app_localizations_it.dart+++ b/lib/l10n/app_localizations_it.dart@@ -1620,6 +1620,29 @@ class AppLocalizationsIt extends AppLocalizations {@overrideString get coverShapeLabel => 'Cover shape';+ @override+ String get showSubtitles => 'Show subtitles';++ @override+ String get showSubtitlesOnSubtitle =>+ 'Subtitles show under book titles in the library and on home';++ @override+ String get showSubtitlesOffSubtitle =>+ 'Off - subtitles only on the book details sheet';++ @override+ String get subtitleVisibilityLabel => 'Subtitles';++ @override+ String get subtitleVisibilityDefault => 'Default';++ @override+ String get subtitleVisibilityShow => 'Show';++ @override+ String get subtitleVisibilityHide => 'Hide';+@overrideString currentLibrarySettingsTitle(String name) {return 'Current library: $name';diff --git a/lib/l10n/app_localizations_ja.dart b/lib/l10n/app_localizations_ja.dartindex 1ca65228..77603803 100644--- a/lib/l10n/app_localizations_ja.dart+++ b/lib/l10n/app_localizations_ja.dart@@ -1620,6 +1620,29 @@ class AppLocalizationsJa extends AppLocalizations {@overrideString get coverShapeLabel => 'Cover shape';+ @override+ String get showSubtitles => 'Show subtitles';++ @override+ String get showSubtitlesOnSubtitle =>+ 'Subtitles show under book titles in the library and on home';++ @override+ String get showSubtitlesOffSubtitle =>+ 'Off - subtitles only on the book details sheet';++ @override+ String get subtitleVisibilityLabel => 'Subtitles';++ @override+ String get subtitleVisibilityDefault => 'Default';++ @override+ String get subtitleVisibilityShow => 'Show';++ @override+ String get subtitleVisibilityHide => 'Hide';+@overrideString currentLibrarySettingsTitle(String name) {return 'Current library: $name';diff --git a/lib/l10n/app_localizations_no.dart b/lib/l10n/app_localizations_no.dartindex 9c187e04..1597e061 100644--- a/lib/l10n/app_localizations_no.dart+++ b/lib/l10n/app_localizations_no.dart@@ -1620,6 +1620,29 @@ class AppLocalizationsNo extends AppLocalizations {@overrideString get coverShapeLabel => 'Cover shape';+ @override+ String get showSubtitles => 'Show subtitles';++ @override+ String get showSubtitlesOnSubtitle =>+ 'Subtitles show under book titles in the library and on home';++ @override+ String get showSubtitlesOffSubtitle =>+ 'Off - subtitles only on the book details sheet';++ @override+ String get subtitleVisibilityLabel => 'Subtitles';++ @override+ String get subtitleVisibilityDefault => 'Default';++ @override+ String get subtitleVisibilityShow => 'Show';++ @override+ String get subtitleVisibilityHide => 'Hide';+@overrideString currentLibrarySettingsTitle(String name) {return 'Current library: $name';diff --git a/lib/l10n/app_localizations_pt.dart b/lib/l10n/app_localizations_pt.dartindex 868436fc..5d2b4b76 100644--- a/lib/l10n/app_localizations_pt.dart+++ b/lib/l10n/app_localizations_pt.dart@@ -1620,6 +1620,29 @@ class AppLocalizationsPt extends AppLocalizations {@overrideString get coverShapeLabel => 'Cover shape';+ @override+ String get showSubtitles => 'Show subtitles';++ @override+ String get showSubtitlesOnSubtitle =>+ 'Subtitles show under book titles in the library and on home';++ @override+ String get showSubtitlesOffSubtitle =>+ 'Off - subtitles only on the book details sheet';++ @override+ String get subtitleVisibilityLabel => 'Subtitles';++ @override+ String get subtitleVisibilityDefault => 'Default';++ @override+ String get subtitleVisibilityShow => 'Show';++ @override+ String get subtitleVisibilityHide => 'Hide';+@overrideString currentLibrarySettingsTitle(String name) {return 'Current library: $name';diff --git a/lib/l10n/app_localizations_ro.dart b/lib/l10n/app_localizations_ro.dartindex ddcb63f3..44d5f126 100644--- a/lib/l10n/app_localizations_ro.dart+++ b/lib/l10n/app_localizations_ro.dart@@ -1620,6 +1620,29 @@ class AppLocalizationsRo extends AppLocalizations {@overrideString get coverShapeLabel => 'Cover shape';+ @override+ String get showSubtitles => 'Show subtitles';++ @override+ String get showSubtitlesOnSubtitle =>+ 'Subtitles show under book titles in the library and on home';++ @override+ String get showSubtitlesOffSubtitle =>+ 'Off - subtitles only on the book details sheet';++ @override+ String get subtitleVisibilityLabel => 'Subtitles';++ @override+ String get subtitleVisibilityDefault => 'Default';++ @override+ String get subtitleVisibilityShow => 'Show';++ @override+ String get subtitleVisibilityHide => 'Hide';+@overrideString currentLibrarySettingsTitle(String name) {return 'Current library: $name';diff --git a/lib/l10n/app_localizations_ru.dart b/lib/l10n/app_localizations_ru.dartindex 54fa68c1..ef7b6cfd 100644--- a/lib/l10n/app_localizations_ru.dart+++ b/lib/l10n/app_localizations_ru.dart@@ -1622,6 +1622,29 @@ class AppLocalizationsRu extends AppLocalizations {@overrideString get coverShapeLabel => 'Cover shape';+ @override+ String get showSubtitles => 'Show subtitles';++ @override+ String get showSubtitlesOnSubtitle =>+ 'Subtitles show under book titles in the library and on home';++ @override+ String get showSubtitlesOffSubtitle =>+ 'Off - subtitles only on the book details sheet';++ @override+ String get subtitleVisibilityLabel => 'Subtitles';++ @override+ String get subtitleVisibilityDefault => 'Default';++ @override+ String get subtitleVisibilityShow => 'Show';++ @override+ String get subtitleVisibilityHide => 'Hide';+@overrideString currentLibrarySettingsTitle(String name) {return 'Current library: $name';diff --git a/lib/l10n/app_localizations_zh.dart b/lib/l10n/app_localizations_zh.dartindex 7419cb9e..f9f40498 100644--- a/lib/l10n/app_localizations_zh.dart+++ b/lib/l10n/app_localizations_zh.dart@@ -1595,6 +1595,29 @@ class AppLocalizationsZh extends AppLocalizations {@overrideString get coverShapeLabel => 'Cover shape';+ @override+ String get showSubtitles => 'Show subtitles';++ @override+ String get showSubtitlesOnSubtitle =>+ 'Subtitles show under book titles in the library and on home';++ @override+ String get showSubtitlesOffSubtitle =>+ 'Off - subtitles only on the book details sheet';++ @override+ String get subtitleVisibilityLabel => 'Subtitles';++ @override+ String get subtitleVisibilityDefault => 'Default';++ @override+ String get subtitleVisibilityShow => 'Show';++ @override+ String get subtitleVisibilityHide => 'Hide';+@overrideString currentLibrarySettingsTitle(String name) {return 'Current library: $name';diff --git a/lib/screens/home_screen.dart b/lib/screens/home_screen.dartindex 9b1f8e71..3f01f5f5 100644--- a/lib/screens/home_screen.dart+++ b/lib/screens/home_screen.dart@@ -42,6 +42,7 @@ class HomeScreenState extends State<HomeScreen> with SingleTickerProviderStateMifinal _player = AudioPlayerService();bool _hideEbookOnly = false;bool _rectangleCovers = false;+ bool _showSubtitles = false;// ── Batch selection ──bool _selectionMode = false;@@ -210,10 +211,12 @@ class HomeScreenState extends State<HomeScreen> with SingleTickerProviderStateMifinal results = await Future.wait([PlayerSettings.getHideEbookOnly(),PlayerSettings.getRectangleCoversFor(libId),+ PlayerSettings.getShowSubtitlesFor(libId),]);if (mounted) setState(() {_hideEbookOnly = results[0];_rectangleCovers = results[1];+ _showSubtitles = results[2];});}@@ -349,6 +352,9 @@ class HomeScreenState extends State<HomeScreen> with SingleTickerProviderStateMiPlayerSettings.getRectangleCoversFor(_coversLibraryId).then((v) {if (mounted && v != _rectangleCovers) setState(() => _rectangleCovers = v);});+ PlayerSettings.getShowSubtitlesFor(_coversLibraryId).then((v) {+ if (mounted && v != _showSubtitles) setState(() => _showSubtitles = v);+ });}if (lib.isLoading) {// Reset cache so stale data isn't shown after a user switch@@ -768,6 +774,7 @@ class HomeScreenState extends State<HomeScreen> with SingleTickerProviderStateMisectionId: id,onTitleTap: _selectionMode ? null : titleTap,coverAspectRatio: _rectangleCovers ? 2 / 3 : 1.0,+ showSubtitles: _showSubtitles,selectionMode: selectionAvailable && _selectionMode,selectedItemIds: _selectedItemIds,onSelectionToggle: selectionAvailablediff --git a/lib/screens/library_screen.dart b/lib/screens/library_screen.dartindex fb0adfcb..95bbe40e 100644--- a/lib/screens/library_screen.dart+++ b/lib/screens/library_screen.dart@@ -471,6 +471,7 @@ class LibraryScreenState extends State<LibraryScreen>// ── Cover aspect ratio ──bool _rectangleCovers = false;+ bool _showSubtitles = false;double get _coverAspectRatio => _rectangleCovers ? 2 / 3 : 1.0;// ── Scroll-to-hide bars ──@@ -600,11 +601,14 @@ class LibraryScreenState extends State<LibraryScreen>lib.selectedLibraryId != null) {_lastLibraryId = lib.selectedLibraryId;_loadGeneration++;- // Cover shape can differ per library.+ // Cover shape and subtitles can differ per library.PlayerSettings.getRectangleCoversFor(lib.selectedLibraryId).then((v) {if (mounted && v != _rectangleCovers)setState(() => _rectangleCovers = v);});+ PlayerSettings.getShowSubtitlesFor(lib.selectedLibraryId).then((v) {+ if (mounted && v != _showSubtitles) setState(() => _showSubtitles = v);+ });// Rebuild tab controller if library type changedfinal needsTabs = !lib.isPodcastLibrary;@@ -681,6 +685,9 @@ class LibraryScreenState extends State<LibraryScreen>PlayerSettings.getRectangleCoversFor(lib.selectedLibraryId).then((v) {if (mounted) setState(() => _rectangleCovers = v);});+ PlayerSettings.getShowSubtitlesFor(lib.selectedLibraryId).then((v) {+ if (mounted) setState(() => _showSubtitles = v);+ });_restoreSortFilter().then((_) {if (!mounted) return;_lastLibraryId = lib.selectedLibraryId;@@ -895,15 +902,22 @@ class LibraryScreenState extends State<LibraryScreen>PlayerSettings.getRectangleCoversFor(context.read<LibraryProvider>().selectedLibraryId,),+ PlayerSettings.getShowSubtitlesFor(+ context.read<LibraryProvider>().selectedLibraryId,+ ),]).then((values) {final newHideEbook = values[0];final newCollapse = values[1];final newRectCovers = values[2];+ final newShowSubtitles = values[3];if (!mounted) return;final coversChanged = newRectCovers != _rectangleCovers;if (coversChanged) {setState(() => _rectangleCovers = newRectCovers);}+ if (newShowSubtitles != _showSubtitles) {+ setState(() => _showSubtitles = newShowSubtitles);+ }if (newHideEbook != _hideEbookOnly || newCollapse != _collapseSeries) {_loadGeneration++;setState(() {@@ -3522,6 +3536,7 @@ class LibraryScreenState extends State<LibraryScreen>tagFilter: _tagFilter,isPodcastLibrary: context.read<LibraryProvider>().isPodcastLibrary,rectangleCovers: _rectangleCovers,+ showSubtitles: _showSubtitles,coverAspectRatio: _coverAspectRatio,onRefresh: _refreshAll,onClearFilter: () => _changeFilter(LibraryFilter.none),diff --git a/lib/screens/settings_screen.dart b/lib/screens/settings_screen.dartindex ac7d5a0f..2bbc0df1 100644--- a/lib/screens/settings_screen.dart+++ b/lib/screens/settings_screen.dart@@ -145,12 +145,14 @@ class _SettingsScreenState extends State<SettingsScreen> {bool _snappyTransitions = false;bool _classicWording = false;bool _rectangleCovers = false;+ bool _showSubtitles = false;String _coverSize = 'medium';// Per-library overrides shown in the Library section, scoped to whichever// library is currently selected (scales to accounts with many libraries -// no giant list, just "whatever you're browsing right now").String? _curLibId;String _curLibCoverShape = 'default'; // 'default' | 'square' | 'rect'+ String _curLibSubtitles = 'default'; // 'default' | 'show' | 'hide'bool _curLibSkipOverride = false;int _curLibSkipForward = 30;int _curLibSkipBack = 10;@@ -956,6 +958,7 @@ class _SettingsScreenState extends State<SettingsScreen> {final mp3IndexSeek = await PlayerSettings.getMp3IndexSeeking();final coverSize = await PlayerSettings.getCoverSize();final flatBackground = await PlayerSettings.getFlatBackground();+ final showSubtitles = await PlayerSettings.getShowSubtitles();final einkMode = await PlayerSettings.getEinkMode();final colorSource = await PlayerSettings.getColorSource();final manualSeed = await PlayerSettings.getManualSeedColor();@@ -1099,6 +1102,7 @@ class _SettingsScreenState extends State<SettingsScreen> {_startScreen = startScreen;// cardBtnLayout removed (now managed in edit sheet)_rectangleCovers = rectCovers;+ _showSubtitles = showSubtitles;_coverSize = coverSize;_coverPlayButton = coverPlay;_cardBackground = cardBg;@@ -1138,16 +1142,86 @@ class _SettingsScreenState extends State<SettingsScreen> {/// different library from the list in this same section.Future<void> _loadCurrentLibraryOverrides(String libraryId) async {final shape = await PlayerSettings.getRectangleCoversOverride(libraryId);+ final subtitles = await PlayerSettings.getShowSubtitlesOverride(libraryId);final skip = await PlayerSettings.getSkipOverride(libraryId);if (mounted) setState(() {_curLibId = libraryId;_curLibCoverShape = shape ?? 'default';+ _curLibSubtitles = subtitles ?? 'default';_curLibSkipOverride = skip != null;_curLibSkipForward = skip?.forward ?? 30;_curLibSkipBack = skip?.back ?? 10;});}+ String _subtitleVisibilityValueLabel(AppLocalizations l, String value) {+ switch (value) {+ case 'show': return l.subtitleVisibilityShow;+ case 'hide': return l.subtitleVisibilityHide;+ default: return l.subtitleVisibilityDefault;+ }+ }++ /// Default/Show/Hide picker for the currently selected library.+ Future<void> _pickCurrentLibrarySubtitles() async {+ final libId = _curLibId;+ if (libId == null) return;+ final cs = Theme.of(context).colorScheme;+ final tt = Theme.of(context).textTheme;+ final l = AppLocalizations.of(context)!;++ final picked = await showModalBottomSheet<String>(+ context: context,+ isScrollControlled: true,+ useSafeArea: true,+ backgroundColor: cs.surfaceContainerLow,+ shape: const RoundedRectangleBorder(+ borderRadius: BorderRadius.vertical(top: Radius.circular(24)),+ ),+ builder: (ctx) => SafeArea(+ child: Column(+ mainAxisSize: MainAxisSize.min,+ children: [+ const SizedBox(height: 8),+ Container(+ width: 40, height: 4,+ decoration: BoxDecoration(+ color: cs.onSurface.withValues(alpha: 0.24),+ borderRadius: BorderRadius.circular(2),+ ),+ ),+ const SizedBox(height: 16),+ Text(l.subtitleVisibilityLabel, style: tt.titleMedium?.copyWith(fontWeight: FontWeight.w600)),+ const SizedBox(height: 8),+ RadioListTile<String>(+ value: 'default',+ groupValue: _curLibSubtitles,+ onChanged: (v) => Navigator.pop(ctx, v),+ title: Text(l.subtitleVisibilityDefault),+ subtitle: Text(_showSubtitles ? l.subtitleVisibilityShow : l.subtitleVisibilityHide),+ ),+ RadioListTile<String>(+ value: 'show',+ groupValue: _curLibSubtitles,+ onChanged: (v) => Navigator.pop(ctx, v),+ title: Text(l.subtitleVisibilityShow),+ ),+ RadioListTile<String>(+ value: 'hide',+ groupValue: _curLibSubtitles,+ onChanged: (v) => Navigator.pop(ctx, v),+ title: Text(l.subtitleVisibilityHide),+ ),+ const SizedBox(height: 8),+ ],+ ),+ ),+ );+ if (picked == null || picked == _curLibSubtitles) return;+ setState(() => _curLibSubtitles = picked);+ await PlayerSettings.setShowSubtitlesOverride(libId, picked == 'default' ? null : picked);+ }+String _coverShapeValueLabel(AppLocalizations l, String value) {switch (value) {case 'rect': return l.coverShapeRectangle;@@ -1941,6 +2015,18 @@ class _SettingsScreenState extends State<SettingsScreen> {} : null,),const Divider(height: 1, indent: 16, endIndent: 16),+ SwitchListTile(+ title: Text(l.showSubtitles),+ subtitle: Text(+ _showSubtitles ? l.showSubtitlesOnSubtitle : l.showSubtitlesOffSubtitle,+ style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant)),+ value: _showSubtitles,+ onChanged: _loaded ? (v) {+ setState(() => _showSubtitles = v);+ PlayerSettings.setShowSubtitles(v);+ } : null,+ ),+ const Divider(height: 1, indent: 16, endIndent: 16),SwitchListTile(title: Text(l.rectangleBookCovers),subtitle: Text(@@ -3677,6 +3763,20 @@ class _SettingsScreenState extends State<SettingsScreen> {),),const Divider(height: 1, indent: 16, endIndent: 16),+ InkWell(+ onTap: _loaded ? () => _pickCurrentLibrarySubtitles() : null,+ child: Padding(+ padding: const EdgeInsets.fromLTRB(16, 14, 16, 14),+ child: Row(children: [+ Expanded(child: Text(l.subtitleVisibilityLabel)),+ Text(_subtitleVisibilityValueLabel(l, _curLibSubtitles),+ style: tt.bodyMedium?.copyWith(color: cs.onSurfaceVariant)),+ Icon(Icons.chevron_right_rounded,+ color: cs.onSurfaceVariant.withValues(alpha: 0.5)),+ ]),+ ),+ ),+ const Divider(height: 1, indent: 16, endIndent: 16),SwitchListTile(title: Text(l.currentLibrarySkipOverride),subtitle: Text(diff --git a/lib/screens/settings_search_index.dart b/lib/screens/settings_search_index.dartindex 1b419bba..6ae9e513 100644--- a/lib/screens/settings_search_index.dart+++ b/lib/screens/settings_search_index.dart@@ -26,6 +26,7 @@ List<SettingSearchEntry> settingsSearchEntries(BuildContext context) {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.showSubtitles, [l.showSubtitlesOnSubtitle, l.showSubtitlesOffSubtitle]),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"']),@@ -114,6 +115,7 @@ List<SettingSearchEntry> settingsSearchEntries(BuildContext context) {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.subtitleVisibilityLabel, [l.subtitleVisibilityDefault, l.subtitleVisibilityShow, l.subtitleVisibilityHide]),SettingSearchEntry('Library', l.sectionLibrary, l.currentLibrarySkipOverride, [l.currentLibrarySkipOverrideOnSubtitle, l.currentLibrarySkipOverrideOffSubtitle]),SettingSearchEntry('Library', l.sectionLibrary, l.currentLibrarySkipBack, const []),SettingSearchEntry('Library', l.sectionLibrary, l.currentLibrarySkipForward, const []),diff --git a/lib/services/player_settings.dart b/lib/services/player_settings.dartindex b740ce47..77553e7e 100644--- a/lib/services/player_settings.dart+++ b/lib/services/player_settings.dart@@ -1014,6 +1014,36 @@ class PlayerSettings {return getRectangleCovers();}+ static Future<bool> getShowSubtitles() => _get('showSubtitles', false);+ static Future<void> setShowSubtitles(bool value) => _set('showSubtitles', value, notify: true);++ /// Per-library subtitle override: 'show', 'hide', or null (= follow the+ /// global toggle). Most libraries leave the field empty, so a library that+ /// does fill it in can show subtitles without the rest going taller.+ static Future<String?> getShowSubtitlesOverride(String libraryId) async {+ final v = await ScopedPrefs.getString('showSubtitles_$libraryId');+ return (v == 'show' || v == 'hide') ? v : null;+ }++ static Future<void> setShowSubtitlesOverride(String libraryId, String? value) async {+ if (value == null) {+ await ScopedPrefs.remove('showSubtitles_$libraryId');+ } else {+ await ScopedPrefs.setString('showSubtitles_$libraryId', value);+ }+ _notify();+ }++ /// Subtitle visibility for a library: its override if set, else the global+ /// toggle.+ static Future<bool> getShowSubtitlesFor(String? libraryId) async {+ if (libraryId != null) {+ final v = await getShowSubtitlesOverride(libraryId);+ if (v != null) return v == 'show';+ }+ return getShowSubtitles();+ }+static Future<bool> getSectionGridView() => _get('sectionGridView', false);static Future<void> setSectionGridView(bool value) => _set('sectionGridView', value);diff --git a/lib/widgets/book_card.dart b/lib/widgets/book_card.dartindex 29eb2c92..6ff76360 100644--- a/lib/widgets/book_card.dart+++ b/lib/widgets/book_card.dart@@ -14,6 +14,7 @@ import 'episode_list_sheet.dart';class BookCard extends StatelessWidget {final Map<String, dynamic> item;final bool showProgress;+ final bool showSubtitle;final bool isWide;final double coverAspectRatio;final String? sourcePlaylistId;@@ -28,6 +29,7 @@ class BookCard extends StatelessWidget {super.key,required this.item,this.showProgress = false,+ this.showSubtitle = false,this.isWide = false,this.coverAspectRatio = 1.0,this.sourcePlaylistId,@@ -51,6 +53,7 @@ class BookCard extends StatelessWidget {final metadata = media['metadata'] as Map<String, dynamic>? ?? {};final title = metadata['title'] as String? ?? l.bookCardUnknownTitle;+ final subtitle = metadata['subtitle'] as String? ?? '';final authorName = metadata['authorName'] as String? ?? '';final coverUrl = lib.getCoverUrl(itemId);@@ -69,7 +72,7 @@ class BookCard extends StatelessWidget {final card = isWide? _buildWideCard(context, cs, tt, l, title, authorName, coverUrl, progress, headers, isExplicit: isExplicit)- : _buildCompactCard(context, cs, tt, l, title, authorName, coverUrl, progress, headers, isFinished: isFinished, isDownloaded: isDownloaded, isExplicit: isExplicit, unfinishedCount: unfinishedCount);+ : _buildCompactCard(context, cs, tt, l, title, subtitle, authorName, coverUrl, progress, headers, isFinished: isFinished, isDownloaded: isDownloaded, isExplicit: isExplicit, unfinishedCount: unfinishedCount);if (!selectionMode) return card;// Selection sits on top of the finished card rather than inside both// layouts: the overlay swallows the tap, so nothing below it can open a@@ -307,6 +310,7 @@ class BookCard extends StatelessWidget {TextTheme tt,AppLocalizations l,String title,+ String subtitle,String authorName,String? coverUrl,double progress,@@ -418,6 +422,20 @@ class BookCard extends StatelessWidget {),),),+ // Subtitle. Keeps its line even when empty so the author lines stay+ // level across a shelf.+ if (showSubtitle)+ Padding(+ padding: const EdgeInsets.symmetric(horizontal: 2),+ child: Text(+ subtitle.isEmpty ? ' ' : subtitle,+ maxLines: 1,+ overflow: TextOverflow.ellipsis,+ style: tt.labelSmall?.copyWith(+ color: cs.onSurfaceVariant.withValues(alpha: 0.75),+ ),+ ),+ ),if (authorName.isNotEmpty)Padding(padding: const EdgeInsets.symmetric(horizontal: 2),diff --git a/lib/widgets/book_detail_sheet.dart b/lib/widgets/book_detail_sheet.dartindex d255edff..0d0193e1 100644--- a/lib/widgets/book_detail_sheet.dart+++ b/lib/widgets/book_detail_sheet.dart@@ -531,6 +531,7 @@ class _BookDetailSheetContentState extends State<_BookDetailSheetContent> {final metadata = media['metadata'] as Map<String, dynamic>? ?? {};final chapters = media['chapters'] as List<dynamic>? ?? [];final title = metadata['title'] as String? ?? l.unknown;+ final subtitle = metadata['subtitle'] as String? ?? '';final authorName = metadata['authorName'] as String? ?? '';final descRaw = metadata['description'] as String? ?? '';final duration = (media['duration'] as num?)?.toDouble() ?? 0;@@ -618,6 +619,11 @@ class _BookDetailSheetContentState extends State<_BookDetailSheetContent> {const SizedBox(height: 16),],Text(title, textAlign: TextAlign.center, style: tt.headlineSmall?.copyWith(fontWeight: FontWeight.w700, color: cs.onSurface)),+ if (subtitle.isNotEmpty) ...[+ const SizedBox(height: 4),+ Text(subtitle, textAlign: TextAlign.center,+ style: tt.titleSmall?.copyWith(color: cs.onSurfaceVariant)),+ ],const SizedBox(height: 4),_buildAuthorLinks(context, metadata, cs, tt, accent),_buildNarratorLinks(context, metadata, cs, tt, accent),diff --git a/lib/widgets/books_sheet_shared.dart b/lib/widgets/books_sheet_shared.dartindex 86ba6694..27ec0dc9 100644--- a/lib/widgets/books_sheet_shared.dart+++ b/lib/widgets/books_sheet_shared.dart@@ -37,16 +37,24 @@ int coverGridCount(BuildContext context) {}}-/// Label scale for cover-grid tiles: 1.0 at the stock phone tile width and-/// growing with the tile, so big tablet or large-cover grids don't pair big-/// covers with tiny labels. Never shrinks below 1.0 on dense grids.-double coverGridTextScale(BuildContext context) {+/// Width of one tile in a cover grid at the current cover size.+double coverGridTileWidth(BuildContext context) {final columns = coverGridCount(context);final width = MediaQuery.of(context).size.width;- final tile = (width - 32 - 10 * (columns - 1)) / columns;- return (tile / 120).clamp(1.0, 1.5);+ return (width - 32 - 10 * (columns - 1)) / columns;}+/// Label scale for cover-grid tiles: 1.0 at the stock phone tile width and+/// growing with the tile, so big tablet or large-cover grids don't pair big+/// covers with tiny labels. Never shrinks below 1.0 on dense grids.+double coverGridTextScale(BuildContext context) =>+ (coverGridTileWidth(context) / 120).clamp(1.0, 1.5);++/// Height a subtitle adds to a tile: one line of label text at the tile's+/// scale, plus a little so rounding can't clip it.+double coverGridSubtitleHeight(BuildContext context) =>+ 10 * coverGridTextScale(context) * 1.6;+/// Decode width in physical pixels for a cover in the current grid. Disk/// caching only saves the download - every tile scrolled into view still/// decodes its bitmap, so decoding at tile size instead of the full serverdiff --git a/lib/widgets/home_section.dart b/lib/widgets/home_section.dartindex b8fe2390..7b736c72 100644--- a/lib/widgets/home_section.dart+++ b/lib/widgets/home_section.dart@@ -18,6 +18,7 @@ class HomeSection extends StatelessWidget {final String sectionId;final VoidCallback? onTitleTap;final double coverAspectRatio;+ final bool showSubtitles;final bool selectionMode;final Set<String> selectedItemIds;final ValueChanged<Map<String, dynamic>>? onSelectionToggle;@@ -31,6 +32,7 @@ class HomeSection extends StatelessWidget {required this.sectionId,this.onTitleTap,this.coverAspectRatio = 1.0,+ this.showSubtitles = false,this.selectionMode = false,this.selectedItemIds = const {},this.onSelectionToggle,@@ -66,8 +68,13 @@ class HomeSection extends StatelessWidget {final bool isRectCover = coverAspectRatio < 1.0;final double cardWidth =isContinueListening ? 300 : (isAuthorSection ? 120 : 140);+ // Book cards grow by a line when subtitles are on; author and episode+ // cards have no subtitle to show, so they stay as they are.+ final bool subtitleLine =+ showSubtitles && !isContinueListening && !effectiveEpisode && !isAuthorSection;final double cardHeight =- isContinueListening ? 120 : effectiveEpisode ? 200 : (isAuthorSection ? 170 : (isRectCover ? 260 : 200));+ (isContinueListening ? 120 : effectiveEpisode ? 200 : (isAuthorSection ? 170 : (isRectCover ? 260 : 200)))+ + (subtitleLine ? 18 : 0);return Padding(padding: const EdgeInsets.only(top: 24),@@ -177,6 +184,7 @@ class HomeSection extends StatelessWidget {child: BookCard(item: entity,showProgress: isContinueListening,+ showSubtitle: subtitleLine,isWide: isContinueListening,coverAspectRatio: isContinueListening ? 1.0 : coverAspectRatio,sourcePlaylistId: sourcePlaylistId,diff --git a/lib/widgets/library_books_tab.dart b/lib/widgets/library_books_tab.dartindex 3eb3fb9b..1be8a7c5 100644--- a/lib/widgets/library_books_tab.dart+++ b/lib/widgets/library_books_tab.dart@@ -1,6 +1,7 @@import 'package:flutter/material.dart';import '../l10n/app_localizations.dart';import '../screens/library_screen.dart';+import 'books_sheet_shared.dart';import 'library_grid_tiles.dart';class LibraryBooksTab extends StatelessWidget {@@ -16,6 +17,7 @@ class LibraryBooksTab extends StatelessWidget {final String? tagFilter;final bool isPodcastLibrary;final bool rectangleCovers;+ final bool showSubtitles;final double coverAspectRatio;final Future<void> Function() onRefresh;final VoidCallback onClearFilter;@@ -55,6 +57,7 @@ class LibraryBooksTab extends StatelessWidget {this.tagFilter,this.isPodcastLibrary = false,required this.rectangleCovers,+ required this.showSubtitles,required this.coverAspectRatio,required this.onRefresh,required this.onClearFilter,@@ -212,6 +215,13 @@ class LibraryBooksTab extends StatelessWidget {gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: cols,childAspectRatio: rectangleCovers ? 0.48 : 0.68,+ // Subtitles add a line under every title, and how much room+ // that needs depends on the cover size, so size the cell from+ // the tile itself rather than from a second fixed ratio.+ mainAxisExtent: showSubtitles+ ? coverGridTileWidth(context) / (rectangleCovers ? 0.48 : 0.68)+ + coverGridSubtitleHeight(context)+ : null,crossAxisSpacing: 10,mainAxisSpacing: 10,),@@ -249,6 +259,7 @@ class LibraryBooksTab extends StatelessWidget {return GridBookTile(item: item,coverAspectRatio: coverAspectRatio,+ showSubtitle: showSubtitles,selectionMode: selectionMode,selected: itemId != null && selectedItemIds.contains(itemId),onSelectionToggle: itemId == null || onSelectionToggle == nulldiff --git a/lib/widgets/library_grid_tiles.dart b/lib/widgets/library_grid_tiles.dartindex eac974a0..79a37802 100644--- a/lib/widgets/library_grid_tiles.dart+++ b/lib/widgets/library_grid_tiles.dart@@ -23,6 +23,7 @@ class GridBookTile extends StatefulWidget {final Map<String, dynamic> item;final double coverAspectRatio;final String? sequenceBadge;+ final bool showSubtitle;final bool selectionMode;final bool selected;final VoidCallback? onSelectionToggle;@@ -32,6 +33,7 @@ class GridBookTile extends StatefulWidget {required this.item,this.coverAspectRatio = 1.0,this.sequenceBadge,+ this.showSubtitle = false,this.selectionMode = false,this.selected = false,this.onSelectionToggle,@@ -71,6 +73,7 @@ class _GridBookTileState extends State<GridBookTile> {final media = widget.item['media'] as Map<String, dynamic>? ?? {};final metadata = media['metadata'] as Map<String, dynamic>? ?? {};final title = metadata['title'] as String? ?? l.unknown;+ final subtitle = metadata['subtitle'] as String? ?? '';final author = metadata['authorName'] as String? ?? '';final coverUrl = lib.getCoverUrl(itemId);final progress = lib.getProgress(itemId);@@ -269,6 +272,18 @@ class _GridBookTileState extends State<GridBookTile> {fontSize: 11 * coverGridTextScale(context),),),+ // Subtitle. Keeps its line even when empty so the author rows+ // stay level across a row of tiles.+ if (widget.showSubtitle)+ Text(+ subtitle.isEmpty ? ' ' : subtitle,+ maxLines: 1,+ overflow: TextOverflow.ellipsis,+ style: tt.labelSmall?.copyWith(+ color: cs.onSurfaceVariant.withValues(alpha: 0.75),+ fontSize: 10 * coverGridTextScale(context),+ ),+ ),// Authorif (author.isNotEmpty)Text(