From 63fc4369917ab548c5cdc4dddccf0ad4ded11a2f Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Thu, 21 May 2026 08:16:59 +0300 Subject: 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 --- player-android/lib/router.dart | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'player-android/lib/router.dart') diff --git a/player-android/lib/router.dart b/player-android/lib/router.dart index 4f1934c..ee101a5 100644 --- a/player-android/lib/router.dart +++ b/player-android/lib/router.dart @@ -106,7 +106,11 @@ final routerProvider = Provider((ref) { // The ':setId' path parameter is guaranteed by the route pattern. final raw = state.pathParameters['setId']!; final setId = int.tryParse(raw) ?? 0; - return MediaGridScreen(setId: setId); + // The set name is optionally passed as a route extra (String) by the + // calling screen (e.g. SetsListScreen) so the app bar can show it + // immediately without an extra API call. + final setName = state.extra is String ? state.extra as String : null; + return MediaGridScreen(setId: setId, setName: setName); }, ), GoRoute( -- cgit v1.2.3