Skip to content

Commit

Permalink
Clear the title and last background art when clearing the playlist
Browse files Browse the repository at this point in the history
  • Loading branch information
insin committed May 11, 2020
1 parent 918a23d commit a8b74a0
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/remote_control.dart
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class _RemoteControlState extends State<RemoteControl> {
//#endregion

//#region Playlist state
List<PlaylistItem> _playlist;
List<PlaylistItem> _playlist = [];
PlaylistItem _playing;
String _backgroundArtUrl;
bool _reusingBackgroundArt = false;
Expand Down Expand Up @@ -311,6 +311,12 @@ class _RemoteControlState extends State<RemoteControl> {

var playlistResponse = VlcPlaylistResponse.fromXmlDocument(document);
setState(() {
// Clear current title and background URL if the playlist is cleared
if (_playlist.isNotEmpty && playlistResponse.items.isEmpty) {
_title = '';
_backgroundArtUrl = '';
_reusingBackgroundArt = false;
}
_playlist = playlistResponse.items;
_playing = playlistResponse.currentItem;
});
Expand Down Expand Up @@ -1005,7 +1011,7 @@ class _RemoteControlState extends State<RemoteControl> {
);
}

if (_playlist == null || _playlist.isEmpty) {
if (_playlist.isEmpty) {
return Expanded(
child: Padding(
padding: EdgeInsets.all(32),
Expand Down

0 comments on commit a8b74a0

Please sign in to comment.