Skip to content

Commit

Permalink
Adaptive playlist (#720)
Browse files Browse the repository at this point in the history
  • Loading branch information
Feichtmeier authored May 9, 2024
1 parent 7fe9527 commit 51e545b
Showing 1 changed file with 53 additions and 51 deletions.
104 changes: 53 additions & 51 deletions lib/src/playlists/view/playlist_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -300,61 +300,63 @@ class _PlaylistPageBody extends StatelessWidget with WatchItMixin {
descriptionWidget: _PlaylistGenreBar(audios: audios),
);

return CustomScrollView(
slivers: [
SliverToBoxAdapter(
child: audioPageHeader,
),
SliverAudioPageControlPanel(controlPanel: audioControlPanel),
if (allowReorder)
SliverReorderableList(
itemCount: audios.length,
itemBuilder: (BuildContext context, int index) {
final audio = audios.elementAt(index);
final audioSelected = currentAudio == audio;
return AdaptiveContainer(
child: CustomScrollView(
slivers: [
SliverToBoxAdapter(
child: audioPageHeader,
),
SliverAudioPageControlPanel(controlPanel: audioControlPanel),
if (allowReorder)
SliverReorderableList(
itemCount: audios.length,
itemBuilder: (BuildContext context, int index) {
final audio = audios.elementAt(index);
final audioSelected = currentAudio == audio;

return ReorderableDragStartListener(
key: ValueKey(audio.path ?? audio.url),
index: index,
child: AudioTile(
onSubTitleTap: onArtistTap,
return ReorderableDragStartListener(
key: ValueKey(audio.path ?? audio.url),
isPlayerPlaying: isPlaying,
pause: playerModel.pause,
startPlaylist: () => playerModel.startPlaylist(
audios: audios,
listName: pageId,
index: index,
index: index,
child: AudioTile(
onSubTitleTap: onArtistTap,
key: ValueKey(audio.path ?? audio.url),
isPlayerPlaying: isPlaying,
pause: playerModel.pause,
startPlaylist: () => playerModel.startPlaylist(
audios: audios,
listName: pageId,
index: index,
),
resume: playerModel.resume,
selected: audioSelected,
audio: audio,
insertIntoQueue: playerModel.insertIntoQueue,
pageId: pageId,
libraryModel: libraryModel,
audioPageType: AudioPageType.playlist,
),
resume: playerModel.resume,
selected: audioSelected,
audio: audio,
insertIntoQueue: playerModel.insertIntoQueue,
pageId: pageId,
libraryModel: libraryModel,
audioPageType: AudioPageType.playlist,
),
);
},
onReorder: (oldIndex, newIndex) {
if (playerModel.queueName == pageId) {
playerModel.moveAudioInQueue(oldIndex, newIndex);
}
);
},
onReorder: (oldIndex, newIndex) {
if (playerModel.queueName == pageId) {
playerModel.moveAudioInQueue(oldIndex, newIndex);
}

libraryModel.moveAudioInPlaylist(
oldIndex: oldIndex,
newIndex: newIndex,
id: pageId,
);
},
)
else
SliverAudioTileList(
audios: audios,
pageId: pageId,
audioPageType: AudioPageType.playlist,
),
],
libraryModel.moveAudioInPlaylist(
oldIndex: oldIndex,
newIndex: newIndex,
id: pageId,
);
},
)
else
SliverAudioTileList(
audios: audios,
pageId: pageId,
audioPageType: AudioPageType.playlist,
),
],
),
);
}
}
Expand Down

0 comments on commit 51e545b

Please sign in to comment.