Change playlist icon

Move versioncode to pubspec
Check if skip in erroe state
This commit is contained in:
stonegate 2020-06-14 16:03:03 +08:00
parent 9740113dfe
commit 4d49bf086e
4 changed files with 29 additions and 10 deletions

View File

@ -49,7 +49,7 @@ android {
applicationId "com.stonegate.tsacdop" applicationId "com.stonegate.tsacdop"
minSdkVersion 19 minSdkVersion 19
targetSdkVersion 29 targetSdkVersion 29
versionCode 17 versionCode flutterVersionCode.toInteger()
versionName flutterVersionName versionName flutterVersionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
} }

View File

@ -12,6 +12,7 @@ import '../state/audiostate.dart';
import '../type/episodebrief.dart'; import '../type/episodebrief.dart';
import '../util/context_extension.dart'; import '../util/context_extension.dart';
import '../util/custompaint.dart'; import '../util/custompaint.dart';
import '../util/colorize.dart';
class PlaylistPage extends StatefulWidget { class PlaylistPage extends StatefulWidget {
@override @override
@ -306,6 +307,9 @@ class _DismissibleContainerState extends State<DismissibleContainer> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
var audio = Provider.of<AudioPlayerNotifier>(context, listen: false); var audio = Provider.of<AudioPlayerNotifier>(context, listen: false);
Color _c = (Theme.of(context).brightness == Brightness.light)
? widget.episode.primaryColor.colorizedark()
: widget.episode.primaryColor.colorizeLight();
return AnimatedContainer( return AnimatedContainer(
duration: Duration(milliseconds: 300), duration: Duration(milliseconds: 300),
alignment: Alignment.center, alignment: Alignment.center,
@ -381,11 +385,19 @@ class _DismissibleContainerState extends State<DismissibleContainer> {
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
), ),
), ),
leading: CircleAvatar( leading: Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: [
Icon(Icons.unfold_more, color: _c),
CircleAvatar(
//backgroundColor: _c.withOpacity(0.5), //backgroundColor: _c.withOpacity(0.5),
backgroundImage: backgroundImage:
FileImage(File("${widget.episode.imagePath}")), FileImage(File("${widget.episode.imagePath}")),
), ),
],
),
subtitle: Container( subtitle: Container(
padding: EdgeInsets.only(top: 5, bottom: 10), padding: EdgeInsets.only(top: 5, bottom: 10),
child: Row( child: Row(
@ -418,7 +430,7 @@ class _DismissibleContainerState extends State<DismissibleContainer> {
], ],
), ),
), ),
trailing: Icon(Icons.menu), //trailing: Icon(Icons.menu),
), ),
// Divider( // Divider(
// height: 2, // height: 2,

View File

@ -422,7 +422,7 @@ class AudioPlayerNotifier extends ChangeNotifier {
} }
playNext() async { playNext() async {
AudioService.skipToNext(); await AudioService.skipToNext();
} }
addToPlaylist(EpisodeBrief episode) async { addToPlaylist(EpisodeBrief episode) async {
@ -678,7 +678,7 @@ class AudioPlayerTask extends BackgroundAudioTask {
}); });
var eventSubscription = _audioPlayer.playbackEventStream.listen((event) { var eventSubscription = _audioPlayer.playbackEventStream.listen((event) {
if (event.playbackError != null) { if (event.playbackError != null) {
_setState(state: BasicPlaybackState.error); _setState(state: _skipState ?? BasicPlaybackState.error);
} }
BasicPlaybackState state; BasicPlaybackState state;
if (event.buffering) { if (event.buffering) {
@ -818,7 +818,14 @@ class AudioPlayerTask extends BackgroundAudioTask {
@override @override
void onClick(MediaButton button) { void onClick(MediaButton button) {
if (button == MediaButton.media)
playPause(); playPause();
else if (button == MediaButton.next)
_audioPlayer.seek(Duration(
milliseconds: AudioServiceBackground.state.position + 30 * 1000));
else if (button == MediaButton.previous)
_audioPlayer.seek(Duration(
milliseconds: AudioServiceBackground.state.position - 10 * 1000));
} }
@override @override

View File

@ -1,7 +1,7 @@
name: tsacdop name: tsacdop
description: An easy-use podacasts player. description: An easy-use podacasts player.
version: 0.3.4 version: 0.3.4+17
environment: environment:
sdk: ">=2.6.0 <3.0.0" sdk: ">=2.6.0 <3.0.0"