mirror of
https://github.com/KRTirtho/spotube.git
synced 2025-09-12 23:45:18 +00:00
fix(track_options): tapping on option doesn't close the menu
This commit is contained in:
parent
7b21eca37b
commit
4a07945214
@ -18,12 +18,15 @@ class TrackOptions extends HookConsumerWidget {
|
|||||||
final bool userPlaylist;
|
final bool userPlaylist;
|
||||||
final String? playlistId;
|
final String? playlistId;
|
||||||
final Widget? icon;
|
final Widget? icon;
|
||||||
|
final VoidCallback? onTapItem;
|
||||||
|
|
||||||
const TrackOptions({
|
const TrackOptions({
|
||||||
super.key,
|
super.key,
|
||||||
required this.track,
|
required this.track,
|
||||||
this.userPlaylist = false,
|
this.userPlaylist = false,
|
||||||
this.playlistId,
|
this.playlistId,
|
||||||
this.icon,
|
this.icon,
|
||||||
|
this.onTapItem,
|
||||||
}) : assert(
|
}) : assert(
|
||||||
track is SpotubeFullTrackObject || track is SpotubeLocalTrackObject,
|
track is SpotubeFullTrackObject || track is SpotubeLocalTrackObject,
|
||||||
"Track must be a SpotubeFullTrackObject, SpotubeLocalTrackObject",
|
"Track must be a SpotubeFullTrackObject, SpotubeLocalTrackObject",
|
||||||
@ -60,6 +63,7 @@ class TrackOptions extends HookConsumerWidget {
|
|||||||
TrackOptionValue.delete,
|
TrackOptionValue.delete,
|
||||||
playlistId,
|
playlistId,
|
||||||
);
|
);
|
||||||
|
onTapItem?.call();
|
||||||
},
|
},
|
||||||
leading: const Icon(SpotubeIcons.trash),
|
leading: const Icon(SpotubeIcons.trash),
|
||||||
title: Text(context.l10n.delete),
|
title: Text(context.l10n.delete),
|
||||||
@ -73,6 +77,7 @@ class TrackOptions extends HookConsumerWidget {
|
|||||||
TrackOptionValue.album,
|
TrackOptionValue.album,
|
||||||
playlistId,
|
playlistId,
|
||||||
);
|
);
|
||||||
|
onTapItem?.call();
|
||||||
},
|
},
|
||||||
leading: const Icon(SpotubeIcons.album),
|
leading: const Icon(SpotubeIcons.album),
|
||||||
title: Column(
|
title: Column(
|
||||||
@ -96,6 +101,7 @@ class TrackOptions extends HookConsumerWidget {
|
|||||||
TrackOptionValue.addToQueue,
|
TrackOptionValue.addToQueue,
|
||||||
playlistId,
|
playlistId,
|
||||||
);
|
);
|
||||||
|
onTapItem?.call();
|
||||||
},
|
},
|
||||||
leading: const Icon(SpotubeIcons.queueAdd),
|
leading: const Icon(SpotubeIcons.queueAdd),
|
||||||
title: Text(context.l10n.add_to_queue),
|
title: Text(context.l10n.add_to_queue),
|
||||||
@ -108,6 +114,7 @@ class TrackOptions extends HookConsumerWidget {
|
|||||||
TrackOptionValue.playNext,
|
TrackOptionValue.playNext,
|
||||||
playlistId,
|
playlistId,
|
||||||
);
|
);
|
||||||
|
onTapItem?.call();
|
||||||
},
|
},
|
||||||
leading: const Icon(SpotubeIcons.lightning),
|
leading: const Icon(SpotubeIcons.lightning),
|
||||||
title: Text(context.l10n.play_next),
|
title: Text(context.l10n.play_next),
|
||||||
@ -121,6 +128,7 @@ class TrackOptions extends HookConsumerWidget {
|
|||||||
TrackOptionValue.removeFromQueue,
|
TrackOptionValue.removeFromQueue,
|
||||||
playlistId,
|
playlistId,
|
||||||
);
|
);
|
||||||
|
onTapItem?.call();
|
||||||
},
|
},
|
||||||
enabled: !isActiveTrack,
|
enabled: !isActiveTrack,
|
||||||
leading: const Icon(SpotubeIcons.queueRemove),
|
leading: const Icon(SpotubeIcons.queueRemove),
|
||||||
@ -135,6 +143,7 @@ class TrackOptions extends HookConsumerWidget {
|
|||||||
TrackOptionValue.favorite,
|
TrackOptionValue.favorite,
|
||||||
playlistId,
|
playlistId,
|
||||||
);
|
);
|
||||||
|
onTapItem?.call();
|
||||||
},
|
},
|
||||||
leading: isLiked
|
leading: isLiked
|
||||||
? const Icon(
|
? const Icon(
|
||||||
@ -157,6 +166,7 @@ class TrackOptions extends HookConsumerWidget {
|
|||||||
TrackOptionValue.startRadio,
|
TrackOptionValue.startRadio,
|
||||||
playlistId,
|
playlistId,
|
||||||
);
|
);
|
||||||
|
onTapItem?.call();
|
||||||
},
|
},
|
||||||
leading: const Icon(SpotubeIcons.radio),
|
leading: const Icon(SpotubeIcons.radio),
|
||||||
title: Text(context.l10n.start_a_radio),
|
title: Text(context.l10n.start_a_radio),
|
||||||
@ -169,6 +179,7 @@ class TrackOptions extends HookConsumerWidget {
|
|||||||
TrackOptionValue.addToPlaylist,
|
TrackOptionValue.addToPlaylist,
|
||||||
playlistId,
|
playlistId,
|
||||||
);
|
);
|
||||||
|
onTapItem?.call();
|
||||||
},
|
},
|
||||||
leading: const Icon(SpotubeIcons.playlistAdd),
|
leading: const Icon(SpotubeIcons.playlistAdd),
|
||||||
title: Text(context.l10n.add_to_playlist),
|
title: Text(context.l10n.add_to_playlist),
|
||||||
@ -183,6 +194,7 @@ class TrackOptions extends HookConsumerWidget {
|
|||||||
TrackOptionValue.removeFromPlaylist,
|
TrackOptionValue.removeFromPlaylist,
|
||||||
playlistId,
|
playlistId,
|
||||||
);
|
);
|
||||||
|
onTapItem?.call();
|
||||||
},
|
},
|
||||||
leading: const Icon(SpotubeIcons.removeFilled),
|
leading: const Icon(SpotubeIcons.removeFilled),
|
||||||
title: Text(context.l10n.remove_from_playlist),
|
title: Text(context.l10n.remove_from_playlist),
|
||||||
@ -196,6 +208,7 @@ class TrackOptions extends HookConsumerWidget {
|
|||||||
TrackOptionValue.download,
|
TrackOptionValue.download,
|
||||||
playlistId,
|
playlistId,
|
||||||
);
|
);
|
||||||
|
onTapItem?.call();
|
||||||
},
|
},
|
||||||
enabled: !isInDownloadQueue,
|
enabled: !isInDownloadQueue,
|
||||||
leading: isInDownloadQueue
|
leading: isInDownloadQueue
|
||||||
@ -217,6 +230,7 @@ class TrackOptions extends HookConsumerWidget {
|
|||||||
TrackOptionValue.blacklist,
|
TrackOptionValue.blacklist,
|
||||||
playlistId,
|
playlistId,
|
||||||
);
|
);
|
||||||
|
onTapItem?.call();
|
||||||
},
|
},
|
||||||
leading: Icon(
|
leading: Icon(
|
||||||
SpotubeIcons.playlistRemove,
|
SpotubeIcons.playlistRemove,
|
||||||
@ -240,6 +254,7 @@ class TrackOptions extends HookConsumerWidget {
|
|||||||
TrackOptionValue.share,
|
TrackOptionValue.share,
|
||||||
playlistId,
|
playlistId,
|
||||||
);
|
);
|
||||||
|
onTapItem?.call();
|
||||||
},
|
},
|
||||||
leading: const Icon(SpotubeIcons.share),
|
leading: const Icon(SpotubeIcons.share),
|
||||||
title: Text(context.l10n.share),
|
title: Text(context.l10n.share),
|
||||||
@ -253,6 +268,7 @@ class TrackOptions extends HookConsumerWidget {
|
|||||||
TrackOptionValue.songlink,
|
TrackOptionValue.songlink,
|
||||||
playlistId,
|
playlistId,
|
||||||
);
|
);
|
||||||
|
onTapItem?.call();
|
||||||
},
|
},
|
||||||
leading: Assets.images.logos.songlinkTransparent.image(
|
leading: Assets.images.logos.songlinkTransparent.image(
|
||||||
width: 22,
|
width: 22,
|
||||||
@ -270,6 +286,7 @@ class TrackOptions extends HookConsumerWidget {
|
|||||||
TrackOptionValue.details,
|
TrackOptionValue.details,
|
||||||
playlistId,
|
playlistId,
|
||||||
);
|
);
|
||||||
|
onTapItem?.call();
|
||||||
},
|
},
|
||||||
leading: const Icon(SpotubeIcons.info),
|
leading: const Icon(SpotubeIcons.info),
|
||||||
title: Text(context.l10n.details),
|
title: Text(context.l10n.details),
|
||||||
|
@ -42,6 +42,9 @@ class TrackOptionsButton extends HookConsumerWidget {
|
|||||||
track: track,
|
track: track,
|
||||||
playlistId: playlistId,
|
playlistId: playlistId,
|
||||||
userPlaylist: userPlaylist,
|
userPlaylist: userPlaylist,
|
||||||
|
onTapItem: () {
|
||||||
|
closeOverlay(context);
|
||||||
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@ -133,6 +136,9 @@ class TrackOptionsButton extends HookConsumerWidget {
|
|||||||
track: track,
|
track: track,
|
||||||
userPlaylist: userPlaylist,
|
userPlaylist: userPlaylist,
|
||||||
playlistId: playlistId,
|
playlistId: playlistId,
|
||||||
|
onTapItem: () {
|
||||||
|
closeDrawer(context);
|
||||||
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
Loading…
Reference in New Issue
Block a user