feat(queue): long-press menu with move up/down for queued items

This commit is contained in:
zarzet
2026-07-27 01:24:14 +07:00
parent e8a3fc58c7
commit 9da3607932
15 changed files with 155 additions and 1 deletions
+44 -1
View File
@@ -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,