a77d4ceac0
Artists tab 404: client called /api/library/artists, but the server mounts the artists list at /api/artists (handleListArtists). Albums sit at /api/library/albums for historical reasons — the paths aren't symmetric. Switch listArtists() to /api/artists with sort=alpha. Albums tab grid: matched the responsive 3-up layout we built for artist detail. LayoutBuilder computes cellW from available width; AlbumCard sized to the cell with titleMaxLines: 2; mainAxisExtent matches actual content height (cover + 2-line title + artist line + fudge). No more wide-aspect cells with empty space below the card. Also wired `extra: ref` on the artists/albums grids and the Liked tab so detail-screen nav hydration kicks in here too — taps from library screens get the same instant header that home tiles do.
37 lines
1.2 KiB
Dart
37 lines
1.2 KiB
Dart
import 'package:dio/dio.dart';
|
|
|
|
import '../../models/album.dart';
|
|
import '../../models/artist.dart';
|
|
import '../../models/page.dart';
|
|
|
|
/// Paged library browse endpoints. Distinct from LibraryApi (which
|
|
/// fetches Home + entity detail) so screens that just need a flat
|
|
/// list don't drag in detail-page providers.
|
|
class LibraryListsApi {
|
|
LibraryListsApi(this._dio);
|
|
final Dio _dio;
|
|
|
|
Future<Paged<ArtistRef>> listArtists({int limit = 50, int offset = 0}) async {
|
|
// Server mounts the artists list at /api/artists (handleListArtists),
|
|
// not /api/library/artists. Albums use /api/library/albums for
|
|
// historical reasons; the paths aren't symmetric.
|
|
final r = await _dio.get<Map<String, dynamic>>(
|
|
'/api/artists',
|
|
queryParameters: {
|
|
'limit': limit,
|
|
'offset': offset,
|
|
'sort': 'alpha',
|
|
},
|
|
);
|
|
return Paged.fromJson(r.data ?? const {}, ArtistRef.fromJson);
|
|
}
|
|
|
|
Future<Paged<AlbumRef>> listAlbums({int limit = 50, int offset = 0}) async {
|
|
final r = await _dio.get<Map<String, dynamic>>(
|
|
'/api/library/albums',
|
|
queryParameters: {'limit': limit, 'offset': offset},
|
|
);
|
|
return Paged.fromJson(r.data ?? const {}, AlbumRef.fromJson);
|
|
}
|
|
}
|