mirror of
https://github.com/zarzet/SpotiFLAC-Mobile.git
synced 2026-04-01 01:20:21 +02:00
feat(ui): add Clear All button to download queue header (#96)
This commit is contained in:
@@ -4,6 +4,10 @@
|
||||
|
||||
### Added
|
||||
|
||||
- **Clear All Queue Button**: Added "Clear All" button next to Pause/Resume in the Downloading section header ([#96](https://github.com/zarzet/SpotiFLAC-Mobile/issues/96))
|
||||
- Quickly cancel all queued downloads with one tap
|
||||
- Confirmation dialog prevents accidental clears
|
||||
- Useful when downloading large playlists
|
||||
- **IDHS Fallback**: Added I Don't Have Spotify (IDHS) as fallback link resolver when SongLink fails
|
||||
- Automatically tries IDHS when SongLink returns errors or rate limits
|
||||
- Supports both Spotify→other platforms and Deezer→other platforms lookups
|
||||
|
||||
@@ -793,6 +793,8 @@ final queueItems = ref.watch(downloadQueueProvider.select((s) => s.items));
|
||||
),
|
||||
const Spacer(),
|
||||
_buildPauseResumeButton(context, ref, colorScheme),
|
||||
const SizedBox(width: 4),
|
||||
_buildClearAllButton(context, ref, colorScheme),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -1177,6 +1179,53 @@ if (queueItems.isEmpty &&
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildClearAllButton(
|
||||
BuildContext context,
|
||||
WidgetRef ref,
|
||||
ColorScheme colorScheme,
|
||||
) {
|
||||
return TextButton.icon(
|
||||
onPressed: () => _showClearAllDialog(context, ref, colorScheme),
|
||||
icon: const Icon(Icons.clear_all, size: 18),
|
||||
label: Text(context.l10n.queueClearAll),
|
||||
style: TextButton.styleFrom(
|
||||
visualDensity: VisualDensity.compact,
|
||||
foregroundColor: colorScheme.error,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> _showClearAllDialog(
|
||||
BuildContext context,
|
||||
WidgetRef ref,
|
||||
ColorScheme colorScheme,
|
||||
) async {
|
||||
final confirmed = await showDialog<bool>(
|
||||
context: context,
|
||||
builder: (ctx) => AlertDialog(
|
||||
title: Text(context.l10n.queueClearAll),
|
||||
content: Text(context.l10n.queueClearAllMessage),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(ctx, false),
|
||||
child: Text(context.l10n.dialogCancel),
|
||||
),
|
||||
FilledButton(
|
||||
onPressed: () => Navigator.pop(ctx, true),
|
||||
style: FilledButton.styleFrom(
|
||||
backgroundColor: colorScheme.error,
|
||||
),
|
||||
child: Text(context.l10n.dialogClear),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
if (confirmed == true && context.mounted) {
|
||||
ref.read(downloadQueueProvider.notifier).clearAll();
|
||||
}
|
||||
}
|
||||
|
||||
Widget _buildEmptyState(
|
||||
BuildContext context,
|
||||
ColorScheme colorScheme,
|
||||
|
||||
Reference in New Issue
Block a user