Minor change.
This commit is contained in:
parent
b3e1d4cb42
commit
a7a3fc7845
|
@ -456,24 +456,24 @@ class __PlaylistButtonState extends State<_PlaylistButton> {
|
||||||
PopupMenuDivider(
|
PopupMenuDivider(
|
||||||
height: 1,
|
height: 1,
|
||||||
),
|
),
|
||||||
PopupMenuItem(
|
// PopupMenuItem(
|
||||||
value: 2,
|
// value: 2,
|
||||||
child: Container(
|
// child: Container(
|
||||||
padding: EdgeInsets.only(left: 10),
|
// padding: EdgeInsets.only(left: 10),
|
||||||
child: Row(
|
// child: Row(
|
||||||
children: <Widget>[
|
// children: <Widget>[
|
||||||
Icon(Icons.history),
|
// Icon(Icons.history),
|
||||||
Padding(
|
// Padding(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 5.0),
|
// padding: const EdgeInsets.symmetric(horizontal: 5.0),
|
||||||
),
|
// ),
|
||||||
Text(s.settingsHistory),
|
// Text(s.settingsHistory),
|
||||||
],
|
// ],
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
PopupMenuDivider(
|
// PopupMenuDivider(
|
||||||
height: 1,
|
// height: 1,
|
||||||
),
|
// ),
|
||||||
],
|
],
|
||||||
onSelected: (value) {
|
onSelected: (value) {
|
||||||
if (value == 0) {
|
if (value == 0) {
|
||||||
|
|
|
@ -280,7 +280,8 @@ class AudioPlayerNotifier extends ChangeNotifier {
|
||||||
if (state[1] != '') {
|
if (state[1] != '') {
|
||||||
_episode = await _dbHelper.getRssItemWithUrl(state[1]);
|
_episode = await _dbHelper.getRssItemWithUrl(state[1]);
|
||||||
} else {
|
} else {
|
||||||
_episode = _queue.episodes.isNotEmpty ? _queue.episodes.first : null;
|
_episode =
|
||||||
|
_playlist.episodes.isNotEmpty ? _playlist.episodes.first : null;
|
||||||
}
|
}
|
||||||
_lastPostion = int.parse(state[2] ?? '0');
|
_lastPostion = int.parse(state[2] ?? '0');
|
||||||
|
|
||||||
|
@ -338,18 +339,19 @@ class AudioPlayerNotifier extends ChangeNotifier {
|
||||||
final history = PlayHistory(_episode.title, _episode.enclosureUrl,
|
final history = PlayHistory(_episode.title, _episode.enclosureUrl,
|
||||||
backgroundAudioPosition ~/ 1000, seekSliderValue);
|
backgroundAudioPosition ~/ 1000, seekSliderValue);
|
||||||
await _dbHelper.saveHistory(history);
|
await _dbHelper.saveHistory(history);
|
||||||
|
_queue.addToPlayListAt(episodeNew, 0);
|
||||||
|
await updatePlaylist(_queue);
|
||||||
if (_playlist.name != 'Queue') {
|
if (_playlist.name != 'Queue') {
|
||||||
AudioService.customAction('setIsQueue', true);
|
AudioService.customAction('setIsQueue', true);
|
||||||
AudioService.customAction('changeQueue', [
|
AudioService.customAction('changeQueue', [
|
||||||
for (var e in _queue.episodes) jsonEncode(e.toMediaItem().toJson())
|
for (var e in _queue.episodes) jsonEncode(e.toMediaItem().toJson())
|
||||||
]);
|
]);
|
||||||
|
_playlist = _queue;
|
||||||
}
|
}
|
||||||
await AudioService.addQueueItemAt(episodeNew.toMediaItem(), 0);
|
await AudioService.addQueueItemAt(episodeNew.toMediaItem(), 0);
|
||||||
if (startPosition > 0) {
|
if (startPosition > 0) {
|
||||||
await AudioService.seekTo(Duration(milliseconds: startPosition));
|
await AudioService.seekTo(Duration(milliseconds: startPosition));
|
||||||
}
|
}
|
||||||
_queue.addToPlayListAt(episodeNew, 0);
|
|
||||||
await updatePlaylist(_queue);
|
|
||||||
_remoteErrorMessage = null;
|
_remoteErrorMessage = null;
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
if (episodeNew.isNew == 1) {
|
if (episodeNew.isNew == 1) {
|
||||||
|
@ -357,7 +359,7 @@ class AudioPlayerNotifier extends ChangeNotifier {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
await _queue.getPlaylist();
|
await _queue.getPlaylist();
|
||||||
await _queue.addToPlayListAt(episodeNew, 0);
|
_queue.addToPlayListAt(episodeNew, 0);
|
||||||
_backgroundAudioDuration = 0;
|
_backgroundAudioDuration = 0;
|
||||||
_backgroundAudioPosition = 0;
|
_backgroundAudioPosition = 0;
|
||||||
_seekSliderValue = 0;
|
_seekSliderValue = 0;
|
||||||
|
@ -375,7 +377,7 @@ class AudioPlayerNotifier extends ChangeNotifier {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _startAudioService(playlist,
|
Future<void> _startAudioService(Playlist playlist,
|
||||||
{int index = 0, int position = 0}) async {
|
{int index = 0, int position = 0}) async {
|
||||||
_stopOnComplete = false;
|
_stopOnComplete = false;
|
||||||
_sleepTimerMode = SleepTimerMode.undefined;
|
_sleepTimerMode = SleepTimerMode.undefined;
|
||||||
|
|
|
@ -99,24 +99,122 @@ class _DismissibleContainerState extends State<DismissibleContainer> {
|
||||||
}),
|
}),
|
||||||
));
|
));
|
||||||
},
|
},
|
||||||
child: SizedBox(
|
child: EpisodeCard(
|
||||||
height: 90.0,
|
widget.episode,
|
||||||
child: Column(
|
isPlaying: false,
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
|
||||||
children: <Widget>[
|
|
||||||
Expanded(
|
|
||||||
child: ListTile(
|
|
||||||
contentPadding: EdgeInsets.symmetric(vertical: 8),
|
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
await context
|
await context
|
||||||
.read<AudioPlayerNotifier>()
|
.read<AudioPlayerNotifier>()
|
||||||
.episodeLoad(widget.episode);
|
.episodeLoad(widget.episode);
|
||||||
widget.onRemove(true);
|
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,
|
||||||
|
// ),
|
||||||
|
// ],
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class EpisodeCard extends StatelessWidget {
|
||||||
|
final EpisodeBrief episode;
|
||||||
|
final Color tileColor;
|
||||||
|
final VoidCallback onTap;
|
||||||
|
final bool isPlaying;
|
||||||
|
const EpisodeCard(this.episode,
|
||||||
|
{this.tileColor, this.onTap, this.isPlaying, Key key})
|
||||||
|
: super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final s = context.s;
|
||||||
|
final c = episode.backgroudColor(context);
|
||||||
|
return SizedBox(
|
||||||
|
height: 90.0,
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||||
|
children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
child: ListTile(
|
||||||
|
tileColor: tileColor,
|
||||||
|
contentPadding: EdgeInsets.symmetric(vertical: 8),
|
||||||
|
onTap: onTap,
|
||||||
title: Container(
|
title: Container(
|
||||||
padding: EdgeInsets.fromLTRB(0, 5.0, 20.0, 5.0),
|
padding: EdgeInsets.fromLTRB(0, 5.0, 20.0, 5.0),
|
||||||
child: Text(
|
child: Text(
|
||||||
widget.episode.title,
|
episode.title,
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
),
|
),
|
||||||
|
@ -126,10 +224,11 @@ class _DismissibleContainerState extends State<DismissibleContainer> {
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
Icon(Icons.unfold_more, color: c),
|
// Icon(Icons.unfold_more, color: c),
|
||||||
|
SizedBox(width: 24),
|
||||||
CircleAvatar(
|
CircleAvatar(
|
||||||
backgroundColor: c.withOpacity(0.5),
|
backgroundColor: c.withOpacity(0.5),
|
||||||
backgroundImage: widget.episode.avatarImage),
|
backgroundImage: episode.avatarImage),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
subtitle: Container(
|
subtitle: Container(
|
||||||
|
@ -137,43 +236,48 @@ class _DismissibleContainerState extends State<DismissibleContainer> {
|
||||||
height: 35,
|
height: 35,
|
||||||
child: Row(
|
child: Row(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
if (widget.episode.explicit == 1)
|
if (episode.explicit == 1)
|
||||||
Container(
|
Container(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Colors.red[800],
|
color: Colors.red[800], shape: BoxShape.circle),
|
||||||
shape: BoxShape.circle),
|
|
||||||
height: 25.0,
|
height: 25.0,
|
||||||
width: 25.0,
|
width: 25.0,
|
||||||
margin: EdgeInsets.only(right: 10.0),
|
margin: EdgeInsets.only(right: 10.0),
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
child: Text('E',
|
child:
|
||||||
style: TextStyle(color: Colors.white))),
|
Text('E', style: TextStyle(color: Colors.white))),
|
||||||
if (widget.episode.duration != 0)
|
if (episode.duration != 0)
|
||||||
episodeTag(
|
episodeTag(
|
||||||
widget.episode.duration == 0
|
episode.duration == 0
|
||||||
? ''
|
? ''
|
||||||
: s.minsCount(
|
: s.minsCount(episode.duration ~/ 60),
|
||||||
widget.episode.duration ~/ 60),
|
|
||||||
Colors.cyan[300]),
|
Colors.cyan[300]),
|
||||||
if (widget.episode.enclosureLength != null)
|
if (episode.enclosureLength != null)
|
||||||
episodeTag(
|
episodeTag(
|
||||||
widget.episode.enclosureLength == 0
|
episode.enclosureLength == 0
|
||||||
? ''
|
? ''
|
||||||
: '${(widget.episode.enclosureLength) ~/ 1000000}MB',
|
: '${(episode.enclosureLength) ~/ 1000000}MB',
|
||||||
Colors.lightBlue[300]),
|
Colors.lightBlue[300]),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
//trailing: Icon(Icons.menu),
|
trailing: isPlaying
|
||||||
|
? Container(
|
||||||
|
height: 20,
|
||||||
|
width: 20,
|
||||||
|
margin: EdgeInsets.symmetric(horizontal: 20),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
shape: BoxShape.circle,
|
||||||
|
),
|
||||||
|
child: WaveLoader(color: context.accentColor))
|
||||||
|
: SizedBox(width: 1),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Divider(
|
Divider(
|
||||||
height: 2,
|
height: 1,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue