Download bug fixes, resuming, lyrics, explicit marking
This commit is contained in:
parent
b9004c3004
commit
a494601ab0
10 changed files with 206 additions and 64 deletions
|
@ -52,6 +52,7 @@ class DownloadTile extends StatelessWidget {
|
|||
subtitle: Text(subtitle),
|
||||
leading: CachedImage(
|
||||
url: download.track.albumArt.thumb,
|
||||
width: 48.0,
|
||||
),
|
||||
trailing: trailing,
|
||||
onTap: () {
|
||||
|
@ -102,30 +103,12 @@ class _DownloadsScreenState extends State<DownloadsScreen> {
|
|||
title: Text('Downloads'),
|
||||
actions: [
|
||||
IconButton(
|
||||
icon: Icon(Icons.delete_sweep),
|
||||
icon: Icon(downloadManager.stopped ? Icons.play_arrow : Icons.stop),
|
||||
onPressed: () {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return AlertDialog(
|
||||
title: Text('Delete'),
|
||||
content: Text('Are you sure, you want to delete all queued downloads?'),
|
||||
actions: [
|
||||
FlatButton(
|
||||
child: Text('Cancel'),
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
),
|
||||
FlatButton(
|
||||
child: Text('Delete'),
|
||||
onPressed: () async {
|
||||
await downloadManager.clearQueue();
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
);
|
||||
setState(() {
|
||||
if (downloadManager.stopped) downloadManager.start();
|
||||
else downloadManager.stop();
|
||||
});
|
||||
},
|
||||
)
|
||||
],
|
||||
|
@ -140,9 +123,41 @@ class _DownloadsScreenState extends State<DownloadsScreen> {
|
|||
return Container(width: 0, height: 0,);
|
||||
|
||||
return Column(
|
||||
children: List.generate(downloadManager.queue.length, (i) {
|
||||
return DownloadTile(downloadManager.queue[i], onDelete: () => setState(() => {}));
|
||||
})
|
||||
children: [
|
||||
...List.generate(downloadManager.queue.length, (i) {
|
||||
return DownloadTile(downloadManager.queue[i], onDelete: () => setState(() => {}));
|
||||
}),
|
||||
if (downloadManager.queue.length > 1 || (downloadManager.stopped && downloadManager.queue.length > 0))
|
||||
ListTile(
|
||||
title: Text('Clear queue'),
|
||||
subtitle: Text("This won't delete currently downloading item"),
|
||||
leading: Icon(Icons.delete),
|
||||
onTap: () async {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return AlertDialog(
|
||||
title: Text('Delete'),
|
||||
content: Text('Are you sure, you want to delete all queued downloads?'),
|
||||
actions: [
|
||||
FlatButton(
|
||||
child: Text('Cancel'),
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
),
|
||||
FlatButton(
|
||||
child: Text('Delete'),
|
||||
onPressed: () async {
|
||||
await downloadManager.clearQueue();
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
);
|
||||
},
|
||||
)
|
||||
]
|
||||
);
|
||||
},
|
||||
),
|
||||
|
|
|
@ -56,20 +56,20 @@ class LibraryScreen extends StatelessWidget {
|
|||
body: ListView(
|
||||
children: <Widget>[
|
||||
Container(height: 4.0,),
|
||||
if (downloadManager.stopped)
|
||||
if (downloadManager.stopped && downloadManager.queue.length > 0)
|
||||
ListTile(
|
||||
title: Text('Downloads'),
|
||||
leading: Icon(Icons.file_download),
|
||||
subtitle: Text('Downloading is currently stopped, click here to resume.'),
|
||||
onTap: () {
|
||||
downloadManager.updateQueue();
|
||||
downloadManager.start();
|
||||
Navigator.of(context).push(MaterialPageRoute(
|
||||
builder: (context) => DownloadsScreen()
|
||||
));
|
||||
},
|
||||
),
|
||||
//Dirty if to not use columns
|
||||
if (downloadManager.stopped)
|
||||
if (downloadManager.stopped && downloadManager.queue.length > 0)
|
||||
Divider(),
|
||||
|
||||
ListTile(
|
||||
|
|
|
@ -497,7 +497,7 @@ class _GeneralSettingsState extends State<GeneralSettings> {
|
|||
),
|
||||
Container(height: 8.0),
|
||||
Text(
|
||||
'Valid variables are: %artists%, %artist%, %title%, %album%, %trackNumber%, %0trackNumber%',
|
||||
'Valid variables are: %artists%, %artist%, %title%, %album%, %trackNumber%, %0trackNumber%, %feats%',
|
||||
style: TextStyle(
|
||||
fontSize: 12.0,
|
||||
),
|
||||
|
|
|
@ -49,6 +49,7 @@ class _TrackTileState extends State<TrackTile> {
|
|||
title: Text(
|
||||
widget.track.title,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.clip,
|
||||
style: TextStyle(
|
||||
color: nowPlaying?Theme.of(context).primaryColor:null
|
||||
),
|
||||
|
@ -59,12 +60,23 @@ class _TrackTileState extends State<TrackTile> {
|
|||
),
|
||||
leading: CachedImage(
|
||||
url: widget.track.albumArt.thumb,
|
||||
width: 48,
|
||||
),
|
||||
onTap: widget.onTap,
|
||||
onLongPress: widget.onHold,
|
||||
trailing: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
if (widget.track.explicit??false)
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 4.0),
|
||||
child: Text(
|
||||
'E',
|
||||
style: TextStyle(
|
||||
color: Colors.red
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 2.0),
|
||||
child: Text(widget.track.durationString),
|
||||
|
@ -98,6 +110,7 @@ class AlbumTile extends StatelessWidget {
|
|||
),
|
||||
leading: CachedImage(
|
||||
url: album.art.thumb,
|
||||
width: 48,
|
||||
),
|
||||
onTap: onTap,
|
||||
onLongPress: onHold,
|
||||
|
@ -172,6 +185,7 @@ class PlaylistTile extends StatelessWidget {
|
|||
),
|
||||
leading: CachedImage(
|
||||
url: playlist.image.thumb,
|
||||
width: 48,
|
||||
),
|
||||
onTap: onTap,
|
||||
onLongPress: onHold,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue