Skip to content

Commit 996cf3d

Browse files
committed
feat: enhance empty state display in playlist and user songs pages
1 parent f8c715f commit 996cf3d

File tree

2 files changed

+61
-3
lines changed

2 files changed

+61
-3
lines changed

lib/screens/playlist_page.dart

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,37 @@ class _PlaylistPageState extends State<PlaylistPage> {
180180
),
181181
),
182182
] else
183-
const SliverFillRemaining(child: SizedBox.expand()),
183+
SliverFillRemaining(
184+
hasScrollBody: false,
185+
child: Center(
186+
child: Padding(
187+
padding: const EdgeInsets.symmetric(horizontal: 32),
188+
child: Column(
189+
mainAxisSize: MainAxisSize.min,
190+
children: [
191+
Icon(
192+
FluentIcons.music_note_1_24_regular,
193+
size: 64,
194+
color: Theme.of(
195+
context,
196+
).colorScheme.onSurface.withAlpha(120),
197+
),
198+
const SizedBox(height: 16),
199+
Text(
200+
context.l10n!.noSongsInPlaylist,
201+
textAlign: TextAlign.center,
202+
style: TextStyle(
203+
color: Theme.of(
204+
context,
205+
).colorScheme.onSurfaceVariant,
206+
fontSize: 16,
207+
),
208+
),
209+
],
210+
),
211+
),
212+
),
213+
),
184214
],
185215
)
186216
: SizedBox(

lib/screens/user_songs_page.dart

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -371,9 +371,37 @@ class _UserSongsPageState extends State<UserSongsPage> {
371371
};
372372

373373
if (displayList.isEmpty) {
374-
return const SliverFillRemaining(
374+
final emptyIcon = isLikedSongs
375+
? FluentIcons.heart_24_regular
376+
: FluentIcons.music_note_1_24_regular;
377+
return SliverFillRemaining(
375378
hasScrollBody: false,
376-
child: SizedBox.expand(),
379+
child: Center(
380+
child: Padding(
381+
padding: const EdgeInsets.symmetric(horizontal: 32),
382+
child: Column(
383+
mainAxisSize: MainAxisSize.min,
384+
children: [
385+
Icon(
386+
emptyIcon,
387+
size: 64,
388+
color: Theme.of(
389+
context,
390+
).colorScheme.onSurface.withAlpha(120),
391+
),
392+
const SizedBox(height: 16),
393+
Text(
394+
context.l10n!.playlistEmpty,
395+
textAlign: TextAlign.center,
396+
style: TextStyle(
397+
color: Theme.of(context).colorScheme.onSurfaceVariant,
398+
fontSize: 16,
399+
),
400+
),
401+
],
402+
),
403+
),
404+
),
377405
);
378406
}
379407

0 commit comments

Comments
 (0)