Skip to content

Commit

Permalink
Improve: Improved the playlist page code
Browse files Browse the repository at this point in the history
  • Loading branch information
gokadzev committed Nov 15, 2023
1 parent 61c7dc3 commit 0e3cb0d
Showing 1 changed file with 10 additions and 17 deletions.
27 changes: 10 additions & 17 deletions lib/screens/playlist_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,16 @@ class _PlaylistPageState extends State<PlaylistPage> {
void initState() {
super.initState();
_isLoading = true;
if (widget.playlistId != null) {
getPlaylistInfoForWidget(widget.playlistId).then(
(value) => {
if (value != null)
{
_playlist = value,
_hasMore = true,
_loadMore(),
},
},
);
} else if (widget.playlistData != null) {
_initializePlaylist();
}

void _initializePlaylist() async {
_playlist = (widget.playlistId != null)
? await getPlaylistInfoForWidget(widget.playlistId)
: widget.playlistData;

if (_playlist != null) {
setState(() {
_playlist = widget.playlistData;
_hasMore = true;
_loadMore();
});
Expand Down Expand Up @@ -320,9 +316,6 @@ class _PlaylistPageState extends State<PlaylistPage> {
],
);
else
return SizedBox(
height: context.screenSize.height - 100,
child: const Spinner(),
);
return const Spinner();
}
}

0 comments on commit 0e3cb0d

Please sign in to comment.