Skip to content

A cross platform Audiobookshelf client for Android and iOS

Dart

Fix no-cover books blocking detail sheet and force transcode for Dolby Atmos

Barnabas632fd250e9d2
diff --git a/lib/providers/_lp_core.dart b/lib/providers/_lp_core.dart
index 23f9f866..8d1d08c4 100644
--- a/lib/providers/_lp_core.dart
+++ b/lib/providers/_lp_core.dart
@@ -723,6 +723,10 @@ mixin _CoreMixin on ChangeNotifier, _StateMixin {
final id = data['id'] as String?;
final ts = data['updatedAt'] as num?;
if (id != null && ts != null) _itemUpdatedAt[id] = ts.toInt();
+ if (id != null) {
+ final coverPath = (data['media'] as Map<String, dynamic>?)?['coverPath'] as String?;
+ registerHasCover(id, coverPath != null && coverPath.isNotEmpty);
+ }
// Invalidate cached session metadata - track URLs may have changed
if (id != null) SessionCache.clear(itemId: id);
loadPersonalizedView(force: true);
@@ -852,6 +856,10 @@ mixin _CoreMixin on ChangeNotifier, _StateMixin {
final id = e['id'] as String?;
final ts = e['updatedAt'] as num?;
if (id != null && ts != null) _itemUpdatedAt[id] = ts.toInt();
+ if (id != null) {
+ final coverPath = (e['media'] as Map<String, dynamic>?)?['coverPath'] as String?;
+ registerHasCover(id, coverPath != null && coverPath.isNotEmpty);
+ }
}
}
}
diff --git a/lib/providers/_lp_state.dart b/lib/providers/_lp_state.dart
index 017cf816..b20fb805 100644
--- a/lib/providers/_lp_state.dart
+++ b/lib/providers/_lp_state.dart
@@ -13,6 +13,7 @@ mixin _StateMixin on ChangeNotifier {
String? _errorMessage;
final Map<String, int> _itemUpdatedAt = {};
+ final Set<String> _itemsWithoutCover = {};
Future<void>? _personalizedInFlight;
Future<void>? _progressShelvesInFlight;
@@ -157,6 +158,14 @@ mixin _StateMixin on ChangeNotifier {
void registerUpdatedAt(String id, int ts) => _itemUpdatedAt[id] = ts;
+ void registerHasCover(String id, bool hasCover) {
+ if (hasCover) {
+ _itemsWithoutCover.remove(id);
+ } else {
+ _itemsWithoutCover.add(id);
+ }
+ }
+
bool _isLikelyNetworkError(Object error) {
return error is SocketException ||
error is TimeoutException ||
@@ -247,6 +256,8 @@ mixin _StateMixin on ChangeNotifier {
final isCompositeKey = itemId.length > 36;
final apiItemId = isCompositeKey ? itemId.substring(0, 36) : itemId;
+ if (_itemsWithoutCover.contains(apiItemId)) return null;
+
if (_api != null && !isOffline) {
final ts = _itemUpdatedAt[apiItemId];
return _api!.getCoverUrl(apiItemId, width: width, updatedAt: ts);
diff --git a/lib/screens/app_shell.dart b/lib/screens/app_shell.dart
index c7a309f6..d0fe2b8e 100644
--- a/lib/screens/app_shell.dart
+++ b/lib/screens/app_shell.dart
@@ -294,23 +294,19 @@ class _AppShellState extends State<AppShell> with WidgetsBindingObserver, Ticker
}
final brightness = Theme.of(context).brightness;
- debugPrint('[CoverScheme] Extracting from $coverUrl for item $itemId');
PaletteGenerator.fromImageProvider(provider, maximumColorCount: 16)
.then((palette) {
final seedColor = palette.vibrantColor?.color
?? palette.dominantColor?.color
?? palette.colors.firstOrNull;
if (seedColor == null) {
- debugPrint('[CoverScheme] No colors extracted');
_lastCoverItemId = null;
return;
}
- debugPrint('[CoverScheme] Extracted seed: $seedColor (vibrant=${palette.vibrantColor?.color}, dominant=${palette.dominantColor?.color})');
final scheme = ColorScheme.fromSeed(seedColor: seedColor, brightness: brightness);
coverSchemeNotifier.value = scheme;
PlayerSettings.setCoverSeedColor(seedColor.toARGB32());
- }).catchError((e) {
- debugPrint('[CoverScheme] Extraction failed: $e');
+ }).catchError((_) {
_lastCoverItemId = null;
});
return true; // cover URL found, image load in progress
diff --git a/lib/screens/library_screen.dart b/lib/screens/library_screen.dart
index 3a3b479c..8c14db93 100644
--- a/lib/screens/library_screen.dart
+++ b/lib/screens/library_screen.dart
@@ -540,6 +540,10 @@ class LibraryScreenState extends State<LibraryScreen> with TickerProviderStateMi
final id = r['id'] as String?;
final ts = r['updatedAt'] as num?;
if (id != null && ts != null) lib.registerUpdatedAt(id, ts.toInt());
+ if (id != null) {
+ final coverPath = (r['media'] as Map<String, dynamic>?)?['coverPath'] as String?;
+ lib.registerHasCover(id, coverPath != null && coverPath.isNotEmpty);
+ }
if (useClientFilter && !DownloadService().isDownloaded(id ?? '')) continue;
if (_hideEbookOnly && PlayerSettings.isEbookOnly(r)) continue;
_items.add(r);
@@ -577,6 +581,10 @@ class LibraryScreenState extends State<LibraryScreen> with TickerProviderStateMi
final id = r['id'] as String?;
final ts = r['updatedAt'] as num?;
if (id != null && ts != null) lib.registerUpdatedAt(id, ts.toInt());
+ if (id != null) {
+ final coverPath = (r['media'] as Map<String, dynamic>?)?['coverPath'] as String?;
+ lib.registerHasCover(id, coverPath != null && coverPath.isNotEmpty);
+ }
if (_hideEbookOnly && PlayerSettings.isEbookOnly(r)) continue;
_items.add(r);
}
diff --git a/lib/services/audio_player_service.dart b/lib/services/audio_player_service.dart
index 57bf96da..1ee207ed 100644
--- a/lib/services/audio_player_service.dart
+++ b/lib/services/audio_player_service.dart
@@ -109,6 +109,13 @@ class AudioPlayerHandler extends BaseAudioHandler with SeekHandler {
Future.delayed(const Duration(seconds: 1), _subscribePlaybackEvents);
} else {
debugPrint('[Player] playbackEvent error - too many rapid failures, stopping re-subscribe: $e');
+ final errStr = e.toString();
+ if (errStr.contains('MediaCodecAudioRenderer') ||
+ errStr.contains('AudioTrack') ||
+ errStr.contains('Decoder') ||
+ errStr.contains('format_supported')) {
+ AudioPlayerService()._retryWithTranscode();
+ }
}
},
onDone: () {
@@ -1766,6 +1773,49 @@ class AudioPlayerService extends ChangeNotifier {
return 'No audio files found - this item may be missing on the server';
}
+ // Detect Dolby Atmos / EAC-3 / AC-3 tracks. Samsung has a hardware Dolby
+ // decoder and iOS AVPlayer handles EAC3 natively, so only force transcode
+ // on other Android devices where the software codec often fails or outputs silence.
+ if (!forceStartTime && Platform.isAndroid &&
+ !ApiService.deviceManufacturer.toLowerCase().contains('samsung')) {
+ final needsTranscode = audioTracks.any((t) {
+ final mime = ((t as Map<String, dynamic>)['mimeType'] as String? ?? '').toLowerCase();
+ final codec = (t['codec'] as String? ?? '').toLowerCase();
+ return mime.contains('eac3') || mime.contains('ac3') || mime.contains('ac4') ||
+ mime.contains('atmos') || codec.contains('eac3') || codec.contains('ac3') ||
+ codec.contains('ac4') || codec.contains('atmos');
+ });
+ if (needsTranscode) {
+ debugPrint('[Player] Dolby/EAC3 track detected - restarting with server transcoding');
+ try { await api.closePlaybackSession(_playbackSessionId!); } catch (_) {}
+ _playbackSessionId = null;
+ final retrySession = _currentEpisodeId != null
+ ? await api.startEpisodePlaybackSession(_currentItemId!, _currentEpisodeId!, forceTranscode: true)
+ : await api.startPlaybackSession(itemId, forceTranscode: true);
+ if (retrySession == null) {
+ _clearState();
+ return 'Could not start transcoded playback';
+ }
+ _playbackSessionId = retrySession['id'] as String?;
+ audioTracks = retrySession['audioTracks'] as List<dynamic>? ?? [];
+ if (audioTracks.isEmpty) {
+ _clearState();
+ return 'No audio files in transcoded session';
+ }
+ final sessionChapters = retrySession['chapters'] as List<dynamic>? ?? [];
+ if (sessionChapters.isNotEmpty) {
+ chapters = sessionChapters;
+ _chapters = sessionChapters;
+ _handler?.updateChaptersQueue(sessionChapters);
+ }
+ final sessionDur = (retrySession['duration'] as num?)?.toDouble() ?? 0;
+ if (sessionDur > 0) {
+ totalDuration = sessionDur;
+ _totalDuration = sessionDur;
+ }
+ }
+ }
+
// Pick up chapters from session (e.g. podcast episodes with embedded chapters)
if (chapters.isEmpty) {
final sessionChapters = sessionData['chapters'] as List<dynamic>? ?? [];
@@ -1990,6 +2040,97 @@ class AudioPlayerService extends ChangeNotifier {
}
}
+ bool _transcodeRetryInFlight = false;
+
+ Future<void> _retryWithTranscode() async {
+ if (_transcodeRetryInFlight) return;
+ _transcodeRetryInFlight = true;
+ try {
+ final api = _api;
+ if (api == null || _currentItemId == null) return;
+ debugPrint('[Player] Codec error in playback stream - retrying with server transcoding');
+ final itemId = _currentItemId!;
+ final retryEpId = _currentEpisodeId;
+ final retryEpTitle = _currentEpisodeTitle;
+ final retryTitle = _currentTitle ?? '';
+ final retryAuthor = _currentAuthor ?? '';
+ final retryCover = _currentCoverUrl;
+ final startTime = (_player?.position.inMilliseconds ?? 0) / 1000.0;
+ _clearState();
+ _currentItemId = itemId;
+ _currentEpisodeId = retryEpId;
+ _currentEpisodeTitle = retryEpTitle;
+ _currentTitle = retryTitle;
+ _currentAuthor = retryAuthor;
+ _currentCoverUrl = retryCover;
+ if (_playbackSessionId != null) {
+ try { await api.closePlaybackSession(_playbackSessionId!); } catch (_) {}
+ _playbackSessionId = null;
+ }
+ final retrySession = retryEpId != null
+ ? await api.startEpisodePlaybackSession(itemId, retryEpId, forceTranscode: true)
+ : await api.startPlaybackSession(itemId, forceTranscode: true);
+ if (retrySession == null) return;
+ _playbackSessionId = retrySession['id'] as String?;
+ _lastServerSync = DateTime.now();
+ final retryTracks = retrySession['audioTracks'] as List<dynamic>?;
+ final totalDuration = (retrySession['duration'] as num?)?.toDouble() ?? _totalDuration;
+ final chapters = retrySession['chapters'] as List<dynamic>? ?? _chapters;
+ _chapters = chapters;
+ _totalDuration = totalDuration;
+ if (retryTracks == null || retryTracks.isEmpty) return;
+ _currentTrackIndex = 0;
+ _buildTrackOffsets(retryTracks);
+ AudioSource retrySource;
+ final audioHeaders = api.mediaHeaders;
+ if (retryTracks.length == 1) {
+ final track = retryTracks.first as Map<String, dynamic>;
+ final contentUrl = track['contentUrl'] as String? ?? '';
+ retrySource = AudioSource.uri(Uri.parse(api.buildTrackUrl(contentUrl)), headers: audioHeaders);
+ } else {
+ final sources = <AudioSource>[];
+ for (final t in retryTracks) {
+ final track = t as Map<String, dynamic>;
+ final contentUrl = track['contentUrl'] as String? ?? '';
+ sources.add(AudioSource.uri(Uri.parse(api.buildTrackUrl(contentUrl)), headers: audioHeaders));
+ }
+ retrySource = ConcatenatingAudioSource(children: sources);
+ }
+ await _player!.setAudioSource(retrySource);
+ if (startTime > 0) await _seekAbsolute(startTime);
+ clearSeekTarget();
+ _subscribeTrackIndex();
+ final initChapter = _initChapterInfo(startTime);
+ _pushMediaItem(itemId, retryTitle, retryAuthor, retryCover, totalDuration, chapter: initChapter);
+ final bookSpeed = await PlayerSettings.getBookSpeed(itemId);
+ final speed = bookSpeed ?? await PlayerSettings.getDefaultSpeed();
+ await _player!.setSpeed(speed);
+ await EqualizerService().switchItem(itemId);
+ debugPrint('[Player] Transcoded playback starting at ${speed}x');
+ try { (await AudioSession.instance).setActive(true); } catch (_) {}
+ _player!.play();
+ notifyListeners();
+ _setupSync();
+ Future.delayed(const Duration(milliseconds: 500), () {
+ _handler?.refreshPlaybackState();
+ });
+ final sleepTimer = SleepTimerService();
+ sleepTimer.resetDismiss();
+ sleepTimer.checkAutoSleep();
+ SessionCache.save(
+ itemId: itemId,
+ episodeId: retryEpId,
+ audioTracks: retryTracks,
+ chapters: chapters,
+ totalDuration: totalDuration,
+ );
+ } catch (e) {
+ debugPrint('[Player] Transcode retry failed: $e');
+ } finally {
+ _transcodeRetryInFlight = false;
+ }
+ }
+
/// Set _currentChapterStart/End for the chapter containing [posSeconds].
/// Returns the chapter title (or null) so _pushMediaItem can show it.
String? _initChapterInfo(double posSeconds) {
diff --git a/lib/widgets/absorbing_card.dart b/lib/widgets/absorbing_card.dart
index 5238a7e6..94177f5a 100644
--- a/lib/widgets/absorbing_card.dart
+++ b/lib/widgets/absorbing_card.dart
@@ -641,19 +641,19 @@ class AbsorbingCardState extends State<AbsorbingCard> with AutomaticKeepAliveCli
_coverUrl != null
? _isLocalCover
? BlurPaddedCover(child: Image.file(File(_coverUrl!), fit: _rectangleCovers ? BoxFit.cover : BoxFit.contain,
- errorBuilder: (_, __, ___) => const CoverPlaceholder()),
+ errorBuilder: (_, __, ___) => CoverPlaceholder(title: _title, author: _author)),
blurChild: Image.file(File(_coverUrl!), fit: BoxFit.cover,
errorBuilder: (_, __, ___) => const SizedBox.shrink()),
enabled: !_rectangleCovers)
: BlurPaddedCover(child: CachedNetworkImage(imageUrl: _coverUrl!, fit: _rectangleCovers ? BoxFit.cover : BoxFit.contain,
httpHeaders: mediaHeaders,
- placeholder: (_, __) => const CoverPlaceholder(),
- errorWidget: (_, __, ___) => const CoverPlaceholder()),
+ placeholder: (_, __) => CoverPlaceholder(title: _title, author: _author),
+ errorWidget: (_, __, ___) => CoverPlaceholder(title: _title, author: _author)),
blurChild: CachedNetworkImage(imageUrl: _coverUrl!, fit: BoxFit.cover,
httpHeaders: mediaHeaders,
errorWidget: (_, __, ___) => const SizedBox.shrink()),
enabled: !_rectangleCovers)
- : const CoverPlaceholder(),
+ : CoverPlaceholder(title: _title, author: _author),
// Casting overlay
if (isCastingThis) ...[
Positioned.fill(
diff --git a/lib/widgets/absorbing_shared.dart b/lib/widgets/absorbing_shared.dart
index 3399780e..d016655f 100644
--- a/lib/widgets/absorbing_shared.dart
+++ b/lib/widgets/absorbing_shared.dart
@@ -56,14 +56,50 @@ IconData historyIcon(PlaybackEventType type) {
}
class CoverPlaceholder extends StatelessWidget {
- const CoverPlaceholder({super.key});
+ final String? title;
+ final String? author;
+ const CoverPlaceholder({super.key, this.title, this.author});
@override
Widget build(BuildContext context) {
final cs = Theme.of(context).colorScheme;
+ final hasText = title != null && title!.isNotEmpty;
return Container(
- color: cs.onSurface.withValues(alpha: 0.05),
- child: Center(child: Icon(Icons.headphones_rounded, size: 48, color: cs.onSurface.withValues(alpha: 0.15))),
+ decoration: BoxDecoration(
+ gradient: LinearGradient(
+ begin: Alignment.topLeft,
+ end: Alignment.bottomRight,
+ colors: [
+ cs.primaryContainer,
+ cs.surfaceContainerHighest,
+ ],
+ ),
+ ),
+ child: hasText
+ ? Padding(
+ padding: const EdgeInsets.all(12),
+ child: Column(
+ mainAxisAlignment: MainAxisAlignment.center,
+ children: [
+ Icon(Icons.auto_stories_rounded, size: 28,
+ color: cs.onPrimaryContainer.withValues(alpha: 0.4)),
+ const SizedBox(height: 8),
+ Text(title!, textAlign: TextAlign.center, maxLines: 4,
+ overflow: TextOverflow.ellipsis,
+ style: TextStyle(fontSize: 13, fontWeight: FontWeight.w600,
+ height: 1.2, color: cs.onPrimaryContainer)),
+ if (author != null && author!.isNotEmpty) ...[
+ const SizedBox(height: 4),
+ Text(author!, textAlign: TextAlign.center, maxLines: 2,
+ overflow: TextOverflow.ellipsis,
+ style: TextStyle(fontSize: 11,
+ color: cs.onPrimaryContainer.withValues(alpha: 0.7))),
+ ],
+ ],
+ ),
+ )
+ : Center(child: Icon(Icons.auto_stories_rounded, size: 48,
+ color: cs.onPrimaryContainer.withValues(alpha: 0.3))),
);
}
}
diff --git a/lib/widgets/author_books_sheet.dart b/lib/widgets/author_books_sheet.dart
index ed62d857..f8a0311a 100644
--- a/lib/widgets/author_books_sheet.dart
+++ b/lib/widgets/author_books_sheet.dart
@@ -108,6 +108,10 @@ class _AuthorBooksSheetState extends State<AuthorBooksSheet> {
final id = book['id'] as String?;
final bts = book['updatedAt'] as num?;
if (id != null && bts != null) lib.registerUpdatedAt(id, bts.toInt());
+ if (id != null) {
+ final coverPath = (book['media'] as Map<String, dynamic>?)?['coverPath'] as String?;
+ lib.registerHasCover(id, coverPath != null && coverPath.isNotEmpty);
+ }
}
}
_isLoading = false;
diff --git a/lib/widgets/book_detail_sheet.dart b/lib/widgets/book_detail_sheet.dart
index 83145686..fa569f4e 100644
--- a/lib/widgets/book_detail_sheet.dart
+++ b/lib/widgets/book_detail_sheet.dart
@@ -222,14 +222,23 @@ class _BookDetailSheetContentState extends State<_BookDetailSheetContent> {
setState(() => _coverScheme = ColorScheme.fromSeed(
seedColor: seedColor, brightness: brightness));
}).catchError((_) {
- // Reset so a retry can re-derive if the image wasn't available yet.
- _coverSchemeUrl = null;
+ if (!mounted) return;
+ setState(() {
+ _coverSchemeUrl = null;
+ _coverScheme = ColorScheme.fromSeed(
+ seedColor: Theme.of(context).colorScheme.primary,
+ brightness: brightness,
+ );
+ });
});
}
String? get _coverUrl {
final localCover = _item?['_localCoverUrl'] as String?;
if (localCover != null && localCover.isNotEmpty) return localCover;
+ final media = _item?['media'] as Map<String, dynamic>?;
+ final coverPath = media?['coverPath'] as String?;
+ if (coverPath == null || coverPath.isEmpty) return null;
return context.read<LibraryProvider>().getCoverUrl(widget.itemId, width: 800);
}
@@ -237,6 +246,9 @@ class _BookDetailSheetContentState extends State<_BookDetailSheetContent> {
String? get _fullResCoverUrl {
final localCover = _item?['_localCoverUrl'] as String?;
if (localCover != null && localCover.isNotEmpty) return localCover;
+ final media = _item?['media'] as Map<String, dynamic>?;
+ final coverPath = media?['coverPath'] as String?;
+ if (coverPath == null || coverPath.isEmpty) return null;
return context.read<LibraryProvider>().getCoverUrl(widget.itemId, width: 4000);
}
diff --git a/lib/widgets/expanded_card.dart b/lib/widgets/expanded_card.dart
index 7acac62c..1ea1a094 100644
--- a/lib/widgets/expanded_card.dart
+++ b/lib/widgets/expanded_card.dart
@@ -677,19 +677,19 @@ class _ExpandedCardState extends State<ExpandedCard> {
_coverUrl != null
? _isLocalCover
? BlurPaddedCover(child: Image.file(File(_coverUrl!), fit: _rectangleCovers ? BoxFit.cover : BoxFit.contain,
- errorBuilder: (_, __, ___) => const CoverPlaceholder()),
+ errorBuilder: (_, __, ___) => CoverPlaceholder(title: _title, author: _author)),
blurChild: Image.file(File(_coverUrl!), fit: BoxFit.cover,
errorBuilder: (_, __, ___) => const SizedBox.shrink()),
enabled: !_rectangleCovers)
: BlurPaddedCover(child: CachedNetworkImage(imageUrl: _coverUrl!, fit: _rectangleCovers ? BoxFit.cover : BoxFit.contain,
httpHeaders: mediaHeaders,
- placeholder: (_, __) => const CoverPlaceholder(),
- errorWidget: (_, __, ___) => const CoverPlaceholder()),
+ placeholder: (_, __) => CoverPlaceholder(title: _title, author: _author),
+ errorWidget: (_, __, ___) => CoverPlaceholder(title: _title, author: _author)),
blurChild: CachedNetworkImage(imageUrl: _coverUrl!, fit: BoxFit.cover,
httpHeaders: mediaHeaders,
errorWidget: (_, __, ___) => const SizedBox.shrink()),
enabled: !_rectangleCovers)
- : const CoverPlaceholder(),
+ : CoverPlaceholder(title: _title, author: _author),
// Play/pause overlay
if (_coverPlayButton && !isCastingThis && !isFinished)
Positioned.fill(
diff --git a/lib/widgets/library_grid_tiles.dart b/lib/widgets/library_grid_tiles.dart
index f13232cf..30b333cb 100644
--- a/lib/widgets/library_grid_tiles.dart
+++ b/lib/widgets/library_grid_tiles.dart
@@ -86,8 +86,8 @@ class _GridBookTileState extends State<GridBookTile> {
children: [
// Cover image
coverUrl != null
- ? _blurCover(coverUrl, lib.mediaHeaders, cs, widget.coverAspectRatio)
- : _placeholder(cs),
+ ? _blurCover(coverUrl, lib.mediaHeaders, cs, widget.coverAspectRatio, title, author)
+ : CoverPlaceholder(title: title, author: author),
// Progress bar at bottom of cover
if (progress > 0 && !isFinished)
@@ -230,44 +230,34 @@ class _GridBookTileState extends State<GridBookTile> {
);
}
- Widget _blurCover(String coverUrl, Map<String, String> headers, ColorScheme cs, double aspectRatio) {
+ Widget _blurCover(String coverUrl, Map<String, String> headers, ColorScheme cs, double aspectRatio, String title, String author) {
+ final placeholder = CoverPlaceholder(title: title, author: author);
final isSquare = (aspectRatio - 1.0).abs() < 0.01;
- // Skip blur overhead for rectangular covers - they fill the space naturally
if (!isSquare) {
if (coverUrl.startsWith('/')) {
return Image.file(File(coverUrl), fit: BoxFit.cover,
- errorBuilder: (_, __, ___) => _placeholder(cs));
+ errorBuilder: (_, __, ___) => placeholder);
}
return CachedNetworkImage(imageUrl: coverUrl, fit: BoxFit.cover,
- httpHeaders: headers, placeholder: (_, __) => _placeholder(cs),
- errorWidget: (_, __, ___) => _placeholder(cs));
+ httpHeaders: headers, placeholder: (_, __) => placeholder,
+ errorWidget: (_, __, ___) => placeholder);
}
if (coverUrl.startsWith('/')) {
return BlurPaddedCover(
child: Image.file(File(coverUrl), fit: BoxFit.contain,
- errorBuilder: (_, __, ___) => _placeholder(cs)),
+ errorBuilder: (_, __, ___) => placeholder),
blurChild: Image.file(File(coverUrl), fit: BoxFit.cover,
errorBuilder: (_, __ ,___) => const SizedBox.shrink()),
);
}
return BlurPaddedCover(
child: CachedNetworkImage(imageUrl: coverUrl, fit: BoxFit.contain,
- httpHeaders: headers, placeholder: (_, __) => _placeholder(cs),
- errorWidget: (_, __, ___) => _placeholder(cs)),
+ httpHeaders: headers, placeholder: (_, __) => placeholder,
+ errorWidget: (_, __, ___) => placeholder),
blurChild: CachedNetworkImage(imageUrl: coverUrl, fit: BoxFit.cover,
httpHeaders: headers, errorWidget: (_, __, ___) => const SizedBox.shrink()),
);
}
-
- Widget _placeholder(ColorScheme cs) {
- return Container(
- color: cs.surfaceContainerHighest,
- child: Center(
- child: Icon(Icons.headphones_rounded,
- size: 24, color: cs.onSurfaceVariant.withValues(alpha: 0.3)),
- ),
- );
- }
}
// ═══════════════════════════════════════════════════════════════
diff --git a/lib/widgets/series_books_sheet.dart b/lib/widgets/series_books_sheet.dart
index 3af1751b..753bb8fc 100644
--- a/lib/widgets/series_books_sheet.dart
+++ b/lib/widgets/series_books_sheet.dart
@@ -177,11 +177,19 @@ class _SeriesBooksSheetState extends State<SeriesBooksSheet> {
final id = item['id'] as String?;
final ts = item['updatedAt'] as num?;
if (id != null && ts != null && lib != null) lib.registerUpdatedAt(id, ts.toInt());
+ if (id != null && lib != null) {
+ final coverPath = (item['media'] as Map<String, dynamic>?)?['coverPath'] as String?;
+ lib.registerHasCover(id, coverPath != null && coverPath.isNotEmpty);
+ }
result.add(item);
} else {
final id = b['id'] as String?;
final ts = b['updatedAt'] as num?;
if (id != null && ts != null && lib != null) lib.registerUpdatedAt(id, ts.toInt());
+ if (id != null && lib != null) {
+ final coverPath = (b['media'] as Map<String, dynamic>?)?['coverPath'] as String?;
+ lib.registerHasCover(id, coverPath != null && coverPath.isNotEmpty);
+ }
result.add(Map<String, dynamic>.from(b));
}
}