feat(flutter/home): home screen with five sections
Sections mirror the web home: Recently added · Rediscover (albums + artists) · Most played · Last played artists. Tap routes pushed for albums/artists; track-tap is wired in the player task. Pull-to-refresh re-fetches /api/home.
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import 'package:minstrel/library/home_screen.dart';
|
||||
import 'package:minstrel/library/library_providers.dart';
|
||||
import 'package:minstrel/models/album.dart';
|
||||
import 'package:minstrel/models/artist.dart';
|
||||
import 'package:minstrel/models/home_data.dart';
|
||||
import 'package:minstrel/theme/theme_data.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('home renders sections with rows', (tester) async {
|
||||
final fixture = HomeData(
|
||||
recentlyAddedAlbums: const [
|
||||
AlbumRef(id: 'a', title: 'Geogaddi', artistId: 'x', artistName: 'BoC'),
|
||||
],
|
||||
rediscoverAlbums: const [],
|
||||
rediscoverArtists: const [
|
||||
ArtistRef(id: 'r', name: 'Aphex Twin'),
|
||||
],
|
||||
mostPlayedTracks: const [],
|
||||
lastPlayedArtists: const [],
|
||||
);
|
||||
await tester.pumpWidget(ProviderScope(
|
||||
overrides: [
|
||||
homeProvider.overrideWith((ref) async => fixture),
|
||||
],
|
||||
child: MaterialApp(theme: buildThemeData(), home: const HomeScreen()),
|
||||
));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text('Recently added'), findsOneWidget);
|
||||
expect(find.text('Geogaddi'), findsOneWidget);
|
||||
expect(find.text('Aphex Twin'), findsOneWidget);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user