diff options
| author | Paul Buetow <paul@buetow.org> | 2026-05-21 08:16:59 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-05-21 08:16:59 +0300 |
| commit | 63fc4369917ab548c5cdc4dddccf0ad4ded11a2f (patch) | |
| tree | 7c7641c29a543cfebc4260cc590fe8bd5938ba43 /player-android/lib/api | |
| parent | 6365d47f8257efa830d390c092ee9586aded9040 (diff) | |
Implement MediaGridScreen with grid, loading/empty/error states, and widget tests (ua)
- Replace placeholder MediaGridScreen with a full implementation: loads
media via listMedia(setId:), renders a Material 3 2-column grid of
thumbnail cards with filename, type icon, and duration overlay.
- Add thumbnailUrl(int mediaId) to PlayerApiClient so screen files
construct thumbnail URLs without importing Dio (DIP).
- Add mediaErrorMessage() top-level helper to error_mappers.dart
(Open-Closed Principle; matches setsErrorMessage pattern).
- Update router.dart to forward the set name as a route extra so
MediaGridScreen shows the name in the app bar without extra API calls.
- Update home_screen.dart _SetCard tap to pass set name as route extra.
- Add 10 widget tests covering: loading, grid render, tap navigation
to /media/:id, empty state, error state + retry, and pull-to-refresh.
- All 109 tests pass; flutter analyze reports no issues.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'player-android/lib/api')
| -rw-r--r-- | player-android/lib/api/player_api_client.dart | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/player-android/lib/api/player_api_client.dart b/player-android/lib/api/player_api_client.dart index 13b5ead..9e67d9e 100644 --- a/player-android/lib/api/player_api_client.dart +++ b/player-android/lib/api/player_api_client.dart @@ -133,6 +133,17 @@ class PlayerApiClient { Future<Uint8List> getThumbnail(int mediaId) => throw UnimplementedError(); + /// Returns the URL for a media item's thumbnail image. + /// + /// Constructing the URL here (rather than in the screen layer) keeps the API + /// path constant `/api/v1/media/{id}/thumbnail` in one place and avoids + /// exposing [Dio] or its [BaseOptions] to the UI layer (Dependency Inversion). + /// + /// The base URL is derived from the underlying Dio instance so it is always + /// consistent with the rest of the API calls. + String thumbnailUrl(int mediaId) => + '${rawDio.options.baseUrl}/api/v1/media/$mediaId/thumbnail'; + Future<void> regenerateThumbnail(int mediaId) => throw UnimplementedError(); Future<bool> toggleFavorite(int mediaId) => throw UnimplementedError(); |
