From 11d93482ffae15479ad4a83fafb1375507fde792 Mon Sep 17 00:00:00 2001 From: exttex Date: Wed, 14 Oct 2020 22:20:06 +0200 Subject: [PATCH] Album art not updating fix - 0.5.5 --- lib/ui/player_screen.dart | 32 ++++++++++++++++++++++++++++++++ pubspec.yaml | 2 +- 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/lib/ui/player_screen.dart b/lib/ui/player_screen.dart index 22d015b..3479984 100644 --- a/lib/ui/player_screen.dart +++ b/lib/ui/player_screen.dart @@ -74,6 +74,22 @@ class _PlayerScreenHorizontalState extends State { PageController _pageController = PageController( initialPage: playerHelper.queueIndex, ); + StreamSubscription _currentItemSub; + + @override + void initState() { + _currentItemSub = AudioService.currentMediaItemStream.listen((event) { + _pageController.animateToPage(playerHelper.queueIndex, duration: Duration(milliseconds: 300), curve: Curves.easeInOut); + }); + super.initState(); + } + + @override + void dispose() { + if (_currentItemSub != null) + _currentItemSub.cancel(); + super.dispose(); + } @override Widget build(BuildContext context) { @@ -238,6 +254,22 @@ class _PlayerScreenVerticalState extends State { PageController _pageController = PageController( initialPage: playerHelper.queueIndex, ); + StreamSubscription _currentItemSub; + + @override + void initState() { + _currentItemSub = AudioService.currentMediaItemStream.listen((event) { + _pageController.animateToPage(playerHelper.queueIndex, duration: Duration(milliseconds: 300), curve: Curves.easeInOut); + }); + super.initState(); + } + + @override + void dispose() { + if (_currentItemSub != null) + _currentItemSub.cancel(); + super.dispose(); + } @override Widget build(BuildContext context) { diff --git a/pubspec.yaml b/pubspec.yaml index 68f3a22..97a02f6 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # Read more about iOS versioning at # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -version: 0.5.4+1 +version: 0.5.5+1 environment: sdk: ">=2.8.0 <3.0.0"