diff --git a/lib/screens/library_page.dart b/lib/screens/library_page.dart index ebac132f..289fe462 100644 --- a/lib/screens/library_page.dart +++ b/lib/screens/library_page.dart @@ -78,6 +78,8 @@ class _LibraryPageState extends State { } Widget _buildUserPlaylistsSection(Color primaryColor) { + final isUserPlaylistsEmpty = + userPlaylists.isEmpty && userCustomPlaylists.isEmpty; return Column( children: [ Row( @@ -114,7 +116,9 @@ class _LibraryPageState extends State { onPressed: () => NavigationManager.router.go('/library/userSongs/offline'), cubeIcon: FluentIcons.cellular_off_24_filled, - borderRadius: commonCustomBarRadiusLast, + borderRadius: isUserPlaylistsEmpty + ? commonCustomBarRadiusLast + : BorderRadius.zero, ), ], ), @@ -171,6 +175,10 @@ class _LibraryPageState extends State { } Widget _buildPlaylistListView(BuildContext context, List playlists) { + final isUserPlaylists = playlists.isNotEmpty && + (playlists[0]['source'] == 'user-created' || + playlists[0]['source'] == 'user-youtube'); + final _length = playlists.length + (isUserPlaylists ? 3 : 0); return ListView.builder( shrinkWrap: true, physics: const NeverScrollableScrollPhysics(), @@ -178,7 +186,8 @@ class _LibraryPageState extends State { padding: commonListViewBottmomPadding, itemBuilder: (BuildContext context, index) { final playlist = playlists[index]; - final borderRadius = getItemBorderRadius(index, playlists.length); + final _index = index + (isUserPlaylists ? 3 : 0); + final borderRadius = getItemBorderRadius(_index, _length); return PlaylistBar( key: ValueKey(playlist['ytid']), playlist['title'], diff --git a/lib/utilities/utils.dart b/lib/utilities/utils.dart index 7298cee1..974da95a 100644 --- a/lib/utilities/utils.dart +++ b/lib/utilities/utils.dart @@ -3,7 +3,9 @@ import 'package:musify/utilities/common_variables.dart'; BorderRadius getItemBorderRadius(int index, int totalLength) { const defaultRadius = BorderRadius.zero; - if (index == 0) { + if (totalLength == 1) { + return commonCustomBarRadius; // Only one item + } else if (index == 0) { return commonCustomBarRadiusFirst; // First item } else if (index == totalLength - 1) { return commonCustomBarRadiusLast; // Last item