mirror of
https://github.com/zarzet/SpotiFLAC-Mobile.git
synced 2026-09-30 21:29:36 +02:00
feat(player): swipe track headers and remove individual queue entries
This commit is contained in:
1 parent
ad31299a75
commit
bf7dd5b1c4
9 files changed
+672
-119
No files matched your search
@@ -0,0 +1,41 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
/// Removing a row affects the queue only, never the song on disk.
|
||||
class PlayerQueueDismissible extends StatelessWidget {
|
||||
const PlayerQueueDismissible({
|
||||
super.key,
|
||||
required this.onRemove,
|
||||
required this.child,
|
||||
this.enabled = true,
|
||||
});
|
||||
|
||||
final VoidCallback onRemove;
|
||||
final Widget child;
|
||||
final bool enabled;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => Dismissible(
|
||||
key: const ValueKey('queue-dismiss'),
|
||||
direction: enabled ? DismissDirection.endToStart : DismissDirection.none,
|
||||
// Remove before collapsing so a concurrently playing row is never left
|
||||
// dismissed in the tree. The service resolves the entry by identity.
|
||||
confirmDismiss: (_) async {
|
||||
onRemove();
|
||||
return false;
|
||||
},
|
||||
background: Container(
|
||||
alignment: AlignmentDirectional.centerEnd,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20),
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).colorScheme.error,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: Icon(
|
||||
Icons.delete_outline,
|
||||
color: Theme.of(context).colorScheme.onError,
|
||||
semanticLabel: MaterialLocalizations.of(context).deleteButtonTooltip,
|
||||
),
|
||||
),
|
||||
child: child,
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user