fix(flutter): album/artist covers in artist detail + tighter grid
Drift cache intentionally drops cover_url (server-derived). The adapters comment says "REST cold-cache fallback briefly shows the real values before drift takes over" — but once drift takes over, covers are empty forever. Fix per source: - Album cover: server constructs the URL deterministically as /api/albums/<id>/cover (internal/api/convert.go:69). Mirror that in CachedAlbumAdapter.toRef so AlbumRef.coverUrl is non-empty whether the row came from a fresh fetch or a drift hit. Restores cover art on the artist detail album grid (and any other surface reading albums from drift). - Artist cover: server picks a representative album and reuses its cover (convert.go:98). Drift doesn't store the pointer, so derive client-side via the artist's first loaded album. New _ArtistAvatar prefers a non-empty server-emitted coverUrl and falls back to /api/albums/<firstAlbumId>/cover, then slate while the album list is still loading. Album grid spacing was off because childAspectRatio: 0.8 inflated each cell taller than the AlbumCard's actual ~160dp footprint, leaving a visible gap below every card. Switch to mainAxisExtent: 168 with explicit 8dp main/cross spacing — cells now match the card and sit on a clean grid.
This commit is contained in:
+6
@@ -34,12 +34,18 @@ extension ArtistRefDriftWrite on ArtistRef {
|
||||
|
||||
extension CachedAlbumAdapter on CachedAlbum {
|
||||
/// `artistName` is supplied by the joined CachedArtists row at query time.
|
||||
/// `coverUrl` is reconstructed deterministically from the album id —
|
||||
/// the server emits the same shape (see internal/api/convert.go:69).
|
||||
/// We don't need to persist it, so AlbumRef.coverUrl is non-empty
|
||||
/// even when the row was populated from a sync that didn't carry the
|
||||
/// derived URL.
|
||||
AlbumRef toRef({String artistName = ''}) => AlbumRef(
|
||||
id: id,
|
||||
title: title,
|
||||
sortTitle: sortTitle,
|
||||
artistId: artistId,
|
||||
artistName: artistName,
|
||||
coverUrl: '/api/albums/$id/cover',
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user