From dd848e76e85ec450923794d46ed1c659ecc88950 Mon Sep 17 00:00:00 2001 From: Bryan Van Deusen Date: Sat, 9 May 2026 16:07:41 -0400 Subject: [PATCH] feat(flutter/playlists): empty-state hint on empty playlist detail MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When a playlist has zero tracks, the detail screen previously showed just the header with no indication of what to do next. Adds an inline hint mirroring the web's copy: "No tracks yet. Add some via the \"Add to playlist…\" entry on any track row." Implementation: itemCount goes from tracks.length + 1 to (tracks.isEmpty ? 2 : tracks.length + 1) and the builder emits the hint at index 1 when tracks is empty. Header still renders at index 0. Co-Authored-By: Claude Opus 4.7 (1M context) --- .../lib/playlists/playlist_detail_screen.dart | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/flutter_client/lib/playlists/playlist_detail_screen.dart b/flutter_client/lib/playlists/playlist_detail_screen.dart index d5220c14..c381bb81 100644 --- a/flutter_client/lib/playlists/playlist_detail_screen.dart +++ b/flutter_client/lib/playlists/playlist_detail_screen.dart @@ -51,6 +51,7 @@ class _Body extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { + final fs = Theme.of(context).extension()!; final tracks = detail.tracks; final playable = tracks.where((t) => t.isAvailable).toList(); @@ -58,9 +59,22 @@ class _Body extends ConsumerWidget { onRefresh: () async => ref.refresh(playlistDetailProvider(detail.playlist.id).future), child: ListView.builder( - itemCount: tracks.length + 1, // header + rows + // Header + (track rows | empty hint). + itemCount: tracks.isEmpty ? 2 : tracks.length + 1, itemBuilder: (ctx, i) { if (i == 0) return _Header(detail: detail, playable: playable); + if (tracks.isEmpty) { + return Padding( + padding: const EdgeInsets.all(24), + child: Center( + child: Text( + 'No tracks yet. Add some via the "Add to playlist…" entry on any track row.', + style: TextStyle(color: fs.ash), + textAlign: TextAlign.center, + ), + ), + ); + } final t = tracks[i - 1]; return _PlaylistTrackRow( row: t,