A cross platform Audiobookshelf client for Android and iOS
Dart
Add a progress text size setting for the player
Barnabas53f3eac45c11
diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arbindex 4422cde3..dd907c1f 100644--- a/lib/l10n/app_en.arb+++ b/lib/l10n/app_en.arb@@ -387,6 +387,7 @@"disablePageFadeOnSubtitle": "Pages switch instantly","disablePageFadeOffSubtitle": "Pages fade when switching tabs","rectangleBookCovers": "Rectangle book covers",+ "progressTextSize": "Progress text size","rectangleBookCoversOnSubtitle": "Covers display in 2:3 book proportion","rectangleBookCoversOffSubtitle": "Covers are square","sectionAbsorbingCards": "Absorbing Cards",diff --git a/lib/l10n/app_localizations.dart b/lib/l10n/app_localizations.dartindex 95291084..da82e99a 100644--- a/lib/l10n/app_localizations.dart+++ b/lib/l10n/app_localizations.dart@@ -1546,6 +1546,12 @@ abstract class AppLocalizations {/// **'Rectangle book covers'**String get rectangleBookCovers;+ /// No description provided for @progressTextSize.+ ///+ /// In en, this message translates to:+ /// **'Progress text size'**+ String get progressTextSize;+/// No description provided for @rectangleBookCoversOnSubtitle.////// In en, this message translates to:diff --git a/lib/l10n/app_localizations_de.dart b/lib/l10n/app_localizations_de.dartindex 5e1a62d9..30a1309b 100644--- a/lib/l10n/app_localizations_de.dart+++ b/lib/l10n/app_localizations_de.dart@@ -785,6 +785,9 @@ class AppLocalizationsDe extends AppLocalizations {@overrideString get rectangleBookCovers => 'Rechteckige Buchcover';+ @override+ String get progressTextSize => 'Progress text size';+@overrideString get rectangleBookCoversOnSubtitle =>'Cover werden im 2:3-Buchformat angezeigt';diff --git a/lib/l10n/app_localizations_el.dart b/lib/l10n/app_localizations_el.dartindex 9d08cc76..7c07cb0d 100644--- a/lib/l10n/app_localizations_el.dart+++ b/lib/l10n/app_localizations_el.dart@@ -778,6 +778,9 @@ class AppLocalizationsEl extends AppLocalizations {@overrideString get rectangleBookCovers => 'Rectangle book covers';+ @override+ String get progressTextSize => 'Progress text size';+@overrideString get rectangleBookCoversOnSubtitle =>'Covers display in 2:3 book proportion';diff --git a/lib/l10n/app_localizations_en.dart b/lib/l10n/app_localizations_en.dartindex 4939aa22..8cd2b6cb 100644--- a/lib/l10n/app_localizations_en.dart+++ b/lib/l10n/app_localizations_en.dart@@ -778,6 +778,9 @@ class AppLocalizationsEn extends AppLocalizations {@overrideString get rectangleBookCovers => 'Rectangle book covers';+ @override+ String get progressTextSize => 'Progress text size';+@overrideString get rectangleBookCoversOnSubtitle =>'Covers display in 2:3 book proportion';diff --git a/lib/l10n/app_localizations_es.dart b/lib/l10n/app_localizations_es.dartindex 953b1f81..5c86f915 100644--- a/lib/l10n/app_localizations_es.dart+++ b/lib/l10n/app_localizations_es.dart@@ -778,6 +778,9 @@ class AppLocalizationsEs extends AppLocalizations {@overrideString get rectangleBookCovers => 'Rectangle book covers';+ @override+ String get progressTextSize => 'Progress text size';+@overrideString get rectangleBookCoversOnSubtitle =>'Covers display in 2:3 book proportion';diff --git a/lib/l10n/app_localizations_fr.dart b/lib/l10n/app_localizations_fr.dartindex f1dc3068..f95f30c0 100644--- a/lib/l10n/app_localizations_fr.dart+++ b/lib/l10n/app_localizations_fr.dart@@ -780,6 +780,9 @@ class AppLocalizationsFr extends AppLocalizations {@overrideString get rectangleBookCovers => 'Rectangle book covers';+ @override+ String get progressTextSize => 'Progress text size';+@overrideString get rectangleBookCoversOnSubtitle =>'Covers display in 2:3 book proportion';diff --git a/lib/l10n/app_localizations_it.dart b/lib/l10n/app_localizations_it.dartindex 3b30bd1e..c72ba429 100644--- a/lib/l10n/app_localizations_it.dart+++ b/lib/l10n/app_localizations_it.dart@@ -778,6 +778,9 @@ class AppLocalizationsIt extends AppLocalizations {@overrideString get rectangleBookCovers => 'Rectangle book covers';+ @override+ String get progressTextSize => 'Progress text size';+@overrideString get rectangleBookCoversOnSubtitle =>'Covers display in 2:3 book proportion';diff --git a/lib/l10n/app_localizations_ja.dart b/lib/l10n/app_localizations_ja.dartindex 17183251..9bae3d9d 100644--- a/lib/l10n/app_localizations_ja.dart+++ b/lib/l10n/app_localizations_ja.dart@@ -778,6 +778,9 @@ class AppLocalizationsJa extends AppLocalizations {@overrideString get rectangleBookCovers => 'Rectangle book covers';+ @override+ String get progressTextSize => 'Progress text size';+@overrideString get rectangleBookCoversOnSubtitle =>'Covers display in 2:3 book proportion';diff --git a/lib/l10n/app_localizations_no.dart b/lib/l10n/app_localizations_no.dartindex 255ea015..0bb02e9a 100644--- a/lib/l10n/app_localizations_no.dart+++ b/lib/l10n/app_localizations_no.dart@@ -778,6 +778,9 @@ class AppLocalizationsNo extends AppLocalizations {@overrideString get rectangleBookCovers => 'Rectangle book covers';+ @override+ String get progressTextSize => 'Progress text size';+@overrideString get rectangleBookCoversOnSubtitle =>'Covers display in 2:3 book proportion';diff --git a/lib/l10n/app_localizations_pt.dart b/lib/l10n/app_localizations_pt.dartindex 2662d8cc..d8716358 100644--- a/lib/l10n/app_localizations_pt.dart+++ b/lib/l10n/app_localizations_pt.dart@@ -778,6 +778,9 @@ class AppLocalizationsPt extends AppLocalizations {@overrideString get rectangleBookCovers => 'Rectangle book covers';+ @override+ String get progressTextSize => 'Progress text size';+@overrideString get rectangleBookCoversOnSubtitle =>'Covers display in 2:3 book proportion';diff --git a/lib/l10n/app_localizations_ro.dart b/lib/l10n/app_localizations_ro.dartindex 77fb7388..bdbaa998 100644--- a/lib/l10n/app_localizations_ro.dart+++ b/lib/l10n/app_localizations_ro.dart@@ -778,6 +778,9 @@ class AppLocalizationsRo extends AppLocalizations {@overrideString get rectangleBookCovers => 'Rectangle book covers';+ @override+ String get progressTextSize => 'Progress text size';+@overrideString get rectangleBookCoversOnSubtitle =>'Covers display in 2:3 book proportion';diff --git a/lib/l10n/app_localizations_ru.dart b/lib/l10n/app_localizations_ru.dartindex 1153ffd3..69f36c4f 100644--- a/lib/l10n/app_localizations_ru.dart+++ b/lib/l10n/app_localizations_ru.dart@@ -781,6 +781,9 @@ class AppLocalizationsRu extends AppLocalizations {@overrideString get rectangleBookCovers => 'Rectangle book covers';+ @override+ String get progressTextSize => 'Progress text size';+@overrideString get rectangleBookCoversOnSubtitle =>'Covers display in 2:3 book proportion';diff --git a/lib/l10n/app_localizations_zh.dart b/lib/l10n/app_localizations_zh.dartindex 00021b4b..b84ea19a 100644--- a/lib/l10n/app_localizations_zh.dart+++ b/lib/l10n/app_localizations_zh.dart@@ -764,6 +764,9 @@ class AppLocalizationsZh extends AppLocalizations {@overrideString get rectangleBookCovers => '矩形书籍封面';+ @override+ String get progressTextSize => 'Progress text size';+@overrideString get rectangleBookCoversOnSubtitle => '封面以 2:3 的书籍比例显示';diff --git a/lib/screens/settings_screen.dart b/lib/screens/settings_screen.dartindex 66294823..e983db93 100644--- a/lib/screens/settings_screen.dart+++ b/lib/screens/settings_screen.dart@@ -109,6 +109,7 @@ class _SettingsScreenState extends State<SettingsScreen> {bool _classicWording = false;bool _rectangleCovers = false;bool _coverPlayButton = false;+ double _progressTextScale = 1.0;String _themeMode = 'dark';String _language = '';int _startScreen = 2;@@ -336,8 +337,10 @@ class _SettingsScreenState extends State<SettingsScreen> {PlayerSettings.getLanguage(), // 49PlayerSettings.getClassicWording(), // 50PlayerSettings.getQueuePlaylistId(), // 51+ PlayerSettings.getProgressTextScale(), // 52]);final s = results[0] as AutoRewindSettings;+ final progressScale = results.last as double;final speed = results[1] as double;final wifiOnly = results[2] as bool;final rollingCount = results[3] as int;@@ -437,6 +440,7 @@ class _SettingsScreenState extends State<SettingsScreen> {// cardBtnLayout removed (now managed in edit sheet)_rectangleCovers = rectCovers;_coverPlayButton = coverPlay;+ _progressTextScale = progressScale;_skipChapterBarrier = skipBarrier;_trustAllCerts = trustCerts;_showExplicitBadge = showExplicit;@@ -866,6 +870,37 @@ class _SettingsScreenState extends State<SettingsScreen> {),),const Divider(height: 1, indent: 16, endIndent: 16),+ Padding(+ padding: const EdgeInsets.fromLTRB(16, 12, 16, 12),+ child: Column(+ crossAxisAlignment: CrossAxisAlignment.start,+ children: [+ Text(l.progressTextSize, style: tt.titleSmall),+ const SizedBox(height: 12),+ SizedBox(+ width: double.infinity,+ child: SegmentedButton<double>(+ showSelectedIcon: false,+ segments: const [+ ButtonSegment(value: 1.0, label: Text('A', style: TextStyle(fontSize: 13))),+ ButtonSegment(value: 1.5, label: Text('A', style: TextStyle(fontSize: 17))),+ ButtonSegment(value: 2.0, label: Text('A', style: TextStyle(fontSize: 21))),+ ],+ selected: {_progressTextScale},+ onSelectionChanged: _loaded ? (selected) {+ final v = selected.first;+ setState(() => _progressTextScale = v);+ PlayerSettings.setProgressTextScale(v);+ } : null,+ style: const ButtonStyle(+ visualDensity: VisualDensity.compact,+ ),+ ),+ ),+ ],+ ),+ ),+ const Divider(height: 1, indent: 16, endIndent: 16),SwitchListTile(title: Text(l.disablePageFade),subtitle: Text(diff --git a/lib/services/player_settings.dart b/lib/services/player_settings.dartindex 10e37984..7c19fdee 100644--- a/lib/services/player_settings.dart+++ b/lib/services/player_settings.dart@@ -119,6 +119,12 @@ class PlayerSettings {static Future<String> getAudibleRegion() => _get('audibleRegion', '');static Future<void> setAudibleRegion(String value) => _set('audibleRegion', value);+ /// Font-size multiplier for the elapsed/remaining/percent text on the player+ /// card (GH #230, accessibility). 1.0 = default.+ static Future<double> getProgressTextScale() => _get('progressTextScale', 1.0);+ static Future<void> setProgressTextScale(double v) =>+ _set('progressTextScale', v, notify: true);+static Future<bool> getUpcomingReleasesSortByDate() => _get('upcomingReleasesSortByDate', false);static Future<void> setUpcomingReleasesSortByDate(bool value) => _set('upcomingReleasesSortByDate', value);diff --git a/lib/widgets/absorbing_card.dart b/lib/widgets/absorbing_card.dartindex d648e35d..3ae8f861 100644--- a/lib/widgets/absorbing_card.dart+++ b/lib/widgets/absorbing_card.dart@@ -44,6 +44,7 @@ class AbsorbingCardState extends State<AbsorbingCard> with AutomaticKeepAliveClibool _rectangleCovers = false;bool _coverPlayButton = false;bool _speedAdjustedTime = true;+ double _progressTextScale = 1.0; // elapsed/remaining/percent text size (GH #230)double _savedSpeed = 1.0; // per-book or default speed for inactive displayfinal ValueNotifier<bool> _edgeBarExpanded = ValueNotifier(false);String? _lastRenderLogSig;@@ -173,6 +174,9 @@ class AbsorbingCardState extends State<AbsorbingCard> with AutomaticKeepAliveCliPlayerSettings.getSpeedAdjustedTime().then((v) {if (mounted && v != _speedAdjustedTime) setState(() => _speedAdjustedTime = v);});+ PlayerSettings.getProgressTextScale().then((v) {+ if (mounted && v != _progressTextScale) setState(() => _progressTextScale = v);+ });_loadSavedSpeed();}@@ -564,7 +568,7 @@ class AbsorbingCardState extends State<AbsorbingCard> with AutomaticKeepAliveClifinal remaining = (dur - pos) / speed;final timeStyle = tt.labelSmall?.copyWith(color: isDark ? Colors.white.withValues(alpha: 0.55) : cs.onSurface,- fontWeight: FontWeight.w500, fontSize: compact ? 10 : 11,+ fontWeight: FontWeight.w500, fontSize: (compact ? 10 : 11) * _progressTextScale,fontFeatures: const [FontFeature.tabularFigures()],shadows: [Shadow(color: isDark ? Colors.black.withValues(alpha: 0.6) : Colors.white.withValues(alpha: 0.6), blurRadius: 4)],);diff --git a/lib/widgets/card_progress_bar.dart b/lib/widgets/card_progress_bar.dartindex 8a5ca78e..6f0daf23 100644--- a/lib/widgets/card_progress_bar.dart+++ b/lib/widgets/card_progress_bar.dart@@ -46,6 +46,7 @@ class _CardDualProgressBarState extends State<CardDualProgressBar> with WidgetsB// so the expanded card's book time row matches the small card's behavior// when speed-adjusted time is enabled.double _savedSpeed = 1.0;+ double _progressTextScale = 1.0;bool _isPlaying = false;bool _isCastMode = false;StreamSubscription<Duration>? _posSub;@@ -63,6 +64,7 @@ class _CardDualProgressBarState extends State<CardDualProgressBar> with WidgetsBvoid _loadSettings() {PlayerSettings.getShowBookSlider().then((v) { if (mounted && v != _showBookSlider) setState(() => _showBookSlider = v); });PlayerSettings.getSpeedAdjustedTime().then((v) { if (mounted && v != _speedAdjustedTime) setState(() => _speedAdjustedTime = v); });+ PlayerSettings.getProgressTextScale().then((v) { if (mounted && v != _progressTextScale) setState(() => _progressTextScale = v); });_loadSavedSpeed();}@@ -332,19 +334,19 @@ class _CardDualProgressBarState extends State<CardDualProgressBar> with WidgetsBPadding(padding: const EdgeInsets.only(top: 2, bottom: 6), child: Row(mainAxisAlignment: MainAxisAlignment.spaceBetween,children: [- Text(_fmt(_bookDragValue != null ? _bookDragValue! * totalDur : bookElapsed), style: tt.labelSmall?.copyWith(color: _bookDragValue != null ? cs.onSurface.withValues(alpha: 0.7) : cs.onSurfaceVariant, fontSize: 12, fontWeight: FontWeight.w600, shadows: [Shadow(color: Theme.of(context).brightness == Brightness.dark ? Colors.black.withValues(alpha: 0.5) : Colors.white.withValues(alpha: 0.5), blurRadius: 3)])),+ Text(_fmt(_bookDragValue != null ? _bookDragValue! * totalDur : bookElapsed), style: tt.labelSmall?.copyWith(color: _bookDragValue != null ? cs.onSurface.withValues(alpha: 0.7) : cs.onSurfaceVariant, fontSize: 12 * _progressTextScale, fontWeight: FontWeight.w600, shadows: [Shadow(color: Theme.of(context).brightness == Brightness.dark ? Colors.black.withValues(alpha: 0.5) : Colors.white.withValues(alpha: 0.5), blurRadius: 3)])),if (_bookDragValue != null && _bookScrubSpeed < 1.0) Text(_scrubSpeedLabel(l, _bookScrubSpeed), style: tt.labelSmall?.copyWith(color: widget.accent, fontSize: 11, fontWeight: FontWeight.w500)),- Text('-${_fmt(_bookDragValue != null ? (1.0 - _bookDragValue!) * totalDur : bookRemaining)}', style: tt.labelSmall?.copyWith(color: _bookDragValue != null ? cs.onSurface.withValues(alpha: 0.7) : cs.onSurfaceVariant, fontSize: 12, fontWeight: FontWeight.w600, shadows: [Shadow(color: Theme.of(context).brightness == Brightness.dark ? Colors.black.withValues(alpha: 0.5) : Colors.white.withValues(alpha: 0.5), blurRadius: 3)])),+ Text('-${_fmt(_bookDragValue != null ? (1.0 - _bookDragValue!) * totalDur : bookRemaining)}', style: tt.labelSmall?.copyWith(color: _bookDragValue != null ? cs.onSurface.withValues(alpha: 0.7) : cs.onSurfaceVariant, fontSize: 12 * _progressTextScale, fontWeight: FontWeight.w600, shadows: [Shadow(color: Theme.of(context).brightness == Brightness.dark ? Colors.black.withValues(alpha: 0.5) : Colors.white.withValues(alpha: 0.5), blurRadius: 3)])),],)),] else ...[Row(children: [- Text(_fmt(_bookDragValue != null ? _bookDragValue! * totalDur : bookElapsed), style: tt.labelSmall?.copyWith(color: _bookDragValue != null ? cs.onSurface.withValues(alpha: 0.6) : cs.onSurface.withValues(alpha: 0.5), fontSize: 11, fontWeight: FontWeight.w500, shadows: [Shadow(color: Theme.of(context).brightness == Brightness.dark ? Colors.black.withValues(alpha: 0.5) : Colors.white.withValues(alpha: 0.5), blurRadius: 3)])),+ Text(_fmt(_bookDragValue != null ? _bookDragValue! * totalDur : bookElapsed), style: tt.labelSmall?.copyWith(color: _bookDragValue != null ? cs.onSurface.withValues(alpha: 0.6) : cs.onSurface.withValues(alpha: 0.5), fontSize: 11 * _progressTextScale, fontWeight: FontWeight.w500, shadows: [Shadow(color: Theme.of(context).brightness == Brightness.dark ? Colors.black.withValues(alpha: 0.5) : Colors.white.withValues(alpha: 0.5), blurRadius: 3)])),const SizedBox(width: 8),Expanded(child: ClipRRect(borderRadius: BorderRadius.circular(4),child: LinearProgressIndicator(value: bookProgress, minHeight: 3, backgroundColor: cs.onSurface.withValues(alpha: 0.08), valueColor: AlwaysStoppedAnimation(widget.accent.withValues(alpha: 0.5))))),const SizedBox(width: 8),- Text('-${_fmt(_bookDragValue != null ? (1.0 - _bookDragValue!) * totalDur : bookRemaining)}', style: tt.labelSmall?.copyWith(color: _bookDragValue != null ? cs.onSurface.withValues(alpha: 0.6) : cs.onSurface.withValues(alpha: 0.5), fontSize: 11, fontWeight: FontWeight.w500, shadows: [Shadow(color: Theme.of(context).brightness == Brightness.dark ? Colors.black.withValues(alpha: 0.5) : Colors.white.withValues(alpha: 0.5), blurRadius: 3)])),+ Text('-${_fmt(_bookDragValue != null ? (1.0 - _bookDragValue!) * totalDur : bookRemaining)}', style: tt.labelSmall?.copyWith(color: _bookDragValue != null ? cs.onSurface.withValues(alpha: 0.6) : cs.onSurface.withValues(alpha: 0.5), fontSize: 11 * _progressTextScale, fontWeight: FontWeight.w500, shadows: [Shadow(color: Theme.of(context).brightness == Brightness.dark ? Colors.black.withValues(alpha: 0.5) : Colors.white.withValues(alpha: 0.5), blurRadius: 3)])),]),SizedBox(height: widget.compact ? 4 : 10),],@@ -407,14 +409,14 @@ class _CardDualProgressBarState extends State<CardDualProgressBar> with WidgetsBText(_fmt(_chapterDragValue != null ? (_chapterDragValue! * chapterDur) / speedDiv : chapterElapsed),style: tt.labelSmall?.copyWith(color: _chapterDragValue != null ? widget.accent : cs.onSurface.withValues(alpha: 0.54),- fontSize: 11, fontWeight: FontWeight.w600,+ fontSize: 11 * _progressTextScale, fontWeight: FontWeight.w600,fontFeatures: const [FontFeature.tabularFigures()],shadows: [Shadow(color: Theme.of(context).brightness == Brightness.dark ? Colors.black.withValues(alpha: 0.5) : Colors.white.withValues(alpha: 0.5), blurRadius: 3)])),if (_chapterDragValue != null && _chapterScrubSpeed < 1.0) Text(_scrubSpeedLabel(l, _chapterScrubSpeed), style: tt.labelSmall?.copyWith(color: widget.accent, fontSize: 11, fontWeight: FontWeight.w500)),Text('-${_fmt(_chapterDragValue != null ? ((1.0 - _chapterDragValue!) * chapterDur) / speedDiv : chapterRemaining)}',style: tt.labelSmall?.copyWith(color: _chapterDragValue != null ? widget.accent : cs.onSurface.withValues(alpha: 0.5),- fontSize: 11, fontWeight: FontWeight.w500,+ fontSize: 11 * _progressTextScale, fontWeight: FontWeight.w500,fontFeatures: const [FontFeature.tabularFigures()],shadows: [Shadow(color: Theme.of(context).brightness == Brightness.dark ? Colors.black.withValues(alpha: 0.5) : Colors.white.withValues(alpha: 0.5), blurRadius: 3)])),],diff --git a/lib/widgets/expanded_card.dart b/lib/widgets/expanded_card.dartindex 04b8470f..ba8386ed 100644--- a/lib/widgets/expanded_card.dart+++ b/lib/widgets/expanded_card.dart@@ -88,6 +88,7 @@ class _ExpandedCardState extends State<ExpandedCard> {bool _rectangleCovers = false;bool _coverPlayButton = false;bool _speedAdjustedTime = true;+ double _progressTextScale = 1.0;// Our own route, captured for popUntil when modals are stacked above usRoute<dynamic>? _ownRoute;@@ -216,6 +217,9 @@ class _ExpandedCardState extends State<ExpandedCard> {PlayerSettings.getSpeedAdjustedTime().then((v) {if (mounted && v != _speedAdjustedTime) setState(() => _speedAdjustedTime = v);});+ PlayerSettings.getProgressTextScale().then((v) {+ if (mounted && v != _progressTextScale) setState(() => _progressTextScale = v);+ });}@override@@ -590,7 +594,7 @@ class _ExpandedCardState extends State<ExpandedCard> {child: Text('${(bookProgress * 100).clamp(0, 100).toStringAsFixed(1)}%',style: tt.labelSmall?.copyWith(color: isDark ? Colors.white.withValues(alpha: 0.55) : Colors.black.withValues(alpha: 0.45),- fontWeight: FontWeight.w500, fontSize: compact ? 10 : 11,+ fontWeight: FontWeight.w500, fontSize: (compact ? 10 : 11) * _progressTextScale,fontFeatures: const [ui.FontFeature.tabularFigures()],shadows: [Shadow(color: isDark ? Colors.black.withValues(alpha: 0.6) : Colors.white.withValues(alpha: 0.6), blurRadius: 4)],)),