mirror of
https://github.com/zarzet/SpotiFLAC-Mobile.git
synced 2026-09-27 11:51:56 +02:00
feat(queue): long-press menu with move up/down for queued items
This commit is contained in:
@@ -194,9 +194,13 @@ extension _QueueTabItemWidgets on _QueueTabState {
|
||||
child: InkWell(
|
||||
onTap: isCompleted
|
||||
? () => _navigateToMetadataScreen(item)
|
||||
: item.status == DownloadStatus.failed
|
||||
: item.status == DownloadStatus.failed ||
|
||||
item.status == DownloadStatus.skipped
|
||||
? () => _showDownloadErrorDialog(context, item)
|
||||
: null,
|
||||
onLongPress: item.status == DownloadStatus.queued
|
||||
? () => _showQueuedItemMenu(context, item)
|
||||
: null,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
child: Stack(
|
||||
children: [
|
||||
@@ -479,6 +483,45 @@ extension _QueueTabItemWidgets on _QueueTabState {
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> _showQueuedItemMenu(BuildContext context, DownloadItem item) {
|
||||
final notifier = ref.read(downloadQueueProvider.notifier);
|
||||
return showModalBottomSheet<void>(
|
||||
context: context,
|
||||
showDragHandle: true,
|
||||
builder: (ctx) => SafeArea(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
ListTile(
|
||||
leading: const Icon(Icons.skip_next),
|
||||
title: Text(context.l10n.queueDownloadNext),
|
||||
onTap: () {
|
||||
Navigator.of(ctx).pop();
|
||||
notifier.downloadNext(item.id);
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.arrow_upward),
|
||||
title: Text(context.l10n.queueMoveUp),
|
||||
onTap: () {
|
||||
Navigator.of(ctx).pop();
|
||||
notifier.moveQueuedItem(item.id, -1);
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.arrow_downward),
|
||||
title: Text(context.l10n.queueMoveDown),
|
||||
onTap: () {
|
||||
Navigator.of(ctx).pop();
|
||||
notifier.moveQueuedItem(item.id, 1);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildActionButtons(
|
||||
BuildContext context,
|
||||
DownloadItem item,
|
||||
|
||||
Reference in New Issue
Block a user