💄 Better queue view
This commit is contained in:
@@ -1172,6 +1172,7 @@ class _QueueView extends HookConsumerWidget {
|
|||||||
return ReorderableListView.builder(
|
return ReorderableListView.builder(
|
||||||
padding: const EdgeInsets.all(16),
|
padding: const EdgeInsets.all(16),
|
||||||
itemCount: playlist.medias.length,
|
itemCount: playlist.medias.length,
|
||||||
|
buildDefaultDragHandles: false,
|
||||||
onReorder: (oldIndex, newIndex) {
|
onReorder: (oldIndex, newIndex) {
|
||||||
if (oldIndex < newIndex) {
|
if (oldIndex < newIndex) {
|
||||||
newIndex -= 1;
|
newIndex -= 1;
|
||||||
@@ -1201,6 +1202,10 @@ class _QueueView extends HookConsumerWidget {
|
|||||||
),
|
),
|
||||||
onDismissed: (direction) => player.remove(index),
|
onDismissed: (direction) => player.remove(index),
|
||||||
child: TrackTile(
|
child: TrackTile(
|
||||||
|
leading: Text(
|
||||||
|
(index + 1).toString().padLeft(2, '0'),
|
||||||
|
style: TextStyle(fontSize: 14),
|
||||||
|
).padding(right: 8),
|
||||||
track: db.Track(
|
track: db.Track(
|
||||||
id: -1,
|
id: -1,
|
||||||
path: trackPath,
|
path: trackPath,
|
||||||
@@ -1220,39 +1225,35 @@ class _QueueView extends HookConsumerWidget {
|
|||||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
data: (track) => Dismissible(
|
data: (track) =>
|
||||||
|
ReorderableDelayedDragStartListener(
|
||||||
|
index: index,
|
||||||
|
child: Dismissible(
|
||||||
key: Key('queue_item_$index'),
|
key: Key('queue_item_$index'),
|
||||||
direction: DismissDirection.endToStart,
|
direction: DismissDirection.endToStart,
|
||||||
background: Container(
|
background: Container(
|
||||||
color: Colors.red,
|
color: Colors.red,
|
||||||
alignment: Alignment.centerRight,
|
alignment: Alignment.centerRight,
|
||||||
padding: const EdgeInsets.only(right: 20),
|
padding: const EdgeInsets.only(right: 20),
|
||||||
child: const Icon(Icons.delete, color: Colors.white),
|
child: const Icon(
|
||||||
|
Icons.delete,
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
onDismissed: (direction) => player.remove(index),
|
onDismissed: (direction) => player.remove(index),
|
||||||
child: TrackTile(
|
child: TrackTile(
|
||||||
leading: Row(
|
leading: Text(
|
||||||
children: [
|
|
||||||
Icon(
|
|
||||||
Icons.drag_handle,
|
|
||||||
size: 20,
|
|
||||||
color: Theme.of(
|
|
||||||
context,
|
|
||||||
).colorScheme.onSurface.withValues(alpha: 0.5),
|
|
||||||
),
|
|
||||||
const SizedBox(width: 8),
|
|
||||||
Text(
|
|
||||||
(index + 1).toString().padLeft(2, '0'),
|
(index + 1).toString().padLeft(2, '0'),
|
||||||
style: TextStyle(fontSize: 14),
|
style: TextStyle(fontSize: 14),
|
||||||
),
|
).padding(right: 8),
|
||||||
],
|
|
||||||
).padding(right: 4),
|
|
||||||
track:
|
track:
|
||||||
track ??
|
track ??
|
||||||
db.Track(
|
db.Track(
|
||||||
id: -1,
|
id: -1,
|
||||||
path: trackPath,
|
path: trackPath,
|
||||||
title: Uri.parse(media.uri).pathSegments.last,
|
title: Uri.parse(
|
||||||
|
media.uri,
|
||||||
|
).pathSegments.last,
|
||||||
artist:
|
artist:
|
||||||
media.extras?['artist'] as String? ??
|
media.extras?['artist'] as String? ??
|
||||||
'Unknown Artist',
|
'Unknown Artist',
|
||||||
@@ -1265,9 +1266,15 @@ class _QueueView extends HookConsumerWidget {
|
|||||||
),
|
),
|
||||||
isPlaying: isCurrent,
|
isPlaying: isCurrent,
|
||||||
onTap: () => player.jump(index),
|
onTap: () => player.jump(index),
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
padding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 16,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
|
).clipRRect(
|
||||||
|
all: 8,
|
||||||
|
key: Key('queue_item_error_${index}_rect'),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -34,7 +34,6 @@ class TrackTile extends StatelessWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Container(
|
return Container(
|
||||||
margin: const EdgeInsets.only(bottom: 8),
|
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: isPlaying
|
color: isPlaying
|
||||||
? Theme.of(context).colorScheme.primary.withOpacity(0.2)
|
? Theme.of(context).colorScheme.primary.withOpacity(0.2)
|
||||||
|
|||||||
Reference in New Issue
Block a user