feat(flutter/widgets): CompactTrackCard for dense home Most-played row

Mirrors the web CompactTrackCard — small horizontal cell with cover
art (48dp), title, artist. Tap plays from this track in the section.
Width 176dp matches web's compact density so 25 tracks per row scroll
naturally on phone widths.

Cover URL is derived from track.albumId (/api/albums/<id>/cover) since
TrackRef itself doesn't carry a cover field — same pattern as web's
coverUrl() helper.

Used in the next commit's home Most-played section (3 rows × 25);
otherwise unused this slice.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-09 11:37:40 -04:00
parent 078520f504
commit dccdb00bce
2 changed files with 120 additions and 0 deletions
@@ -0,0 +1,38 @@
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:minstrel/library/widgets/compact_track_card.dart';
import 'package:minstrel/models/track.dart';
import 'package:minstrel/theme/theme_data.dart';
const _track = TrackRef(
id: 't1',
title: 'Roygbiv',
albumId: 'a1',
albumTitle: 'Geogaddi',
artistId: 'ar1',
artistName: 'Boards of Canada',
durationSec: 137,
trackNumber: 4,
streamUrl: '',
);
void main() {
testWidgets('renders title and artist', (tester) async {
await tester.pumpWidget(ProviderScope(
child: MaterialApp(
theme: buildThemeData(),
home: Scaffold(
body: CompactTrackCard(
track: _track,
sectionTracks: const [_track],
index: 0,
),
),
),
));
expect(find.text('Roygbiv'), findsOneWidget);
expect(find.text('Boards of Canada'), findsOneWidget);
});
}