Bug fixs, playlist item was wrongly deleted

This commit is contained in:
stonega 2021-01-24 22:00:32 +08:00
parent 17c3fbdbb7
commit f219ac9d3f
2 changed files with 146 additions and 209 deletions

View File

@ -281,7 +281,7 @@ class __QueueState extends State<_Queue> {
var running = data.item2;
return queue == null
? Center()
: queue?.name == 'Queue'
: queue.isQueue
? ReorderableListView(
onReorder: (oldIndex, newIndex) {
context
@ -336,8 +336,10 @@ class __QueueState extends State<_Queue> {
}
},
);
});
});
},
);
},
);
}
}

View File

@ -33,15 +33,20 @@ class _DismissibleContainerState extends State<DismissibleContainer> {
duration: Duration(milliseconds: 300),
curve: Curves.easeInSine,
alignment: Alignment.center,
height: _delete ? 0 : 90.0,
height: _delete ? 0 : 91.0,
child: _delete
? Container(
color: Colors.transparent,
)
: Dismissible(
: Column(
children: [
Padding(
padding: const EdgeInsets.symmetric(horizontal: 10.0),
child: Dismissible(
key: ValueKey('${widget.episode.enclosureUrl}dis'),
background: Container(
padding: EdgeInsets.symmetric(horizontal: 20.0),
height: 30,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
@ -69,8 +74,6 @@ class _DismissibleContainerState extends State<DismissibleContainer> {
),
],
),
height: 30,
color: context.accentColor,
),
onDismissed: (direction) async {
setState(() {
@ -102,6 +105,7 @@ class _DismissibleContainerState extends State<DismissibleContainer> {
widget.episode,
isPlaying: false,
canReorder: true,
showDivider: false,
onTap: () async {
await context
.read<AudioPlayerNotifier>()
@ -109,80 +113,10 @@ class _DismissibleContainerState extends State<DismissibleContainer> {
widget.onRemove(true);
},
),
// SizedBox(
// height: 90.0,
// child: Column(
// mainAxisAlignment: MainAxisAlignment.spaceAround,
// children: <Widget>[
// Expanded(
// child: ListTile(
// contentPadding: EdgeInsets.symmetric(vertical: 8),
// onTap: () async {
// await context
// .read<AudioPlayerNotifier>()
// .episodeLoad(widget.episode);
// widget.onRemove(true);
// },
// title: Container(
// padding: EdgeInsets.fromLTRB(0, 5.0, 20.0, 5.0),
// child: Text(
// widget.episode.title,
// maxLines: 1,
// overflow: TextOverflow.ellipsis,
// ),
// ),
// leading: Row(
// mainAxisAlignment: MainAxisAlignment.start,
// crossAxisAlignment: CrossAxisAlignment.center,
// mainAxisSize: MainAxisSize.min,
// children: [
// Icon(Icons.unfold_more, color: c),
// CircleAvatar(
// backgroundColor: c.withOpacity(0.5),
// backgroundImage: widget.episode.avatarImage),
// ],
// ),
// subtitle: Container(
// padding: EdgeInsets.only(top: 5, bottom: 5),
// height: 35,
// child: Row(
// children: <Widget>[
// if (widget.episode.explicit == 1)
// Container(
// decoration: BoxDecoration(
// color: Colors.red[800],
// shape: BoxShape.circle),
// height: 25.0,
// width: 25.0,
// margin: EdgeInsets.only(right: 10.0),
// alignment: Alignment.center,
// child: Text('E',
// style: TextStyle(color: Colors.white))),
// if (widget.episode.duration != 0)
// episodeTag(
// widget.episode.duration == 0
// ? ''
// : s.minsCount(
// widget.episode.duration ~/ 60),
// Colors.cyan[300]),
// if (widget.episode.enclosureLength != null)
// episodeTag(
// widget.episode.enclosureLength == 0
// ? ''
// : '${(widget.episode.enclosureLength) ~/ 1000000}MB',
// Colors.lightBlue[300]),
// ],
// ),
// ),
// //trailing: Icon(Icons.menu),
// ),
// ),
// Divider(
// height: 2,
// ),
// ],
// ),
// ),
),
),
Divider(height: 1)
],
),
);
}
@ -194,13 +128,16 @@ class EpisodeCard extends StatelessWidget {
final VoidCallback onTap;
final bool isPlaying;
final bool canReorder;
final bool showDivider;
const EpisodeCard(this.episode,
{this.tileColor,
this.onTap,
this.isPlaying,
this.canReorder = false,
this.showDivider = true,
Key key})
: assert(episode != null), super(key: key);
: assert(episode != null),
super(key: key);
@override
Widget build(BuildContext context) {
@ -278,9 +215,7 @@ class EpisodeCard extends StatelessWidget {
: SizedBox(width: 1),
),
),
Divider(
height: 1,
),
if (showDivider) Divider(height: 1),
],
),
);