Skip to content

Commit

Permalink
feat: watch later yt playlist
Browse files Browse the repository at this point in the history
ref: #1
  • Loading branch information
MSOB7YY committed Jan 7, 2024
1 parent ef7ab43 commit 5bcf955
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions lib/youtube/functions/add_to_playlist_sheet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,27 @@ void showAddToPlaylistSheet({
},
),
),
const SizedBox(width: 12.0),
Obx(
() {
const watchLater = 'Watch Later';
final pl = pc.YoutubePlaylistController.inst.getPlaylist(watchLater);
final idExist = pl?.tracks.firstWhereEff((e) => e.id == ids.firstOrNull) != null;
return NamidaIconButton(
tooltip: watchLater,
icon: Broken.clock,
child: idExist ? const StackedIcon(baseIcon: Broken.clock, secondaryIcon: Broken.tick_circle) : null,
onPressed: () {
final pl = pc.YoutubePlaylistController.inst.getPlaylist(watchLater);
if (pl == null) {
pc.YoutubePlaylistController.inst.addNewPlaylist(watchLater, videoIds: ids);
} else if (pl.tracks.firstWhereEff((e) => e.id == ids.firstOrNull) == null) {
pc.YoutubePlaylistController.inst.addTracksToPlaylist(pl, ids);
}
},
);
},
),
const SizedBox(width: 18.0),
],
),
Expand Down

0 comments on commit 5bcf955

Please sign in to comment.