🐛 Bug fixes

This commit is contained in:
LittleSheep 2024-08-30 22:06:24 +08:00
parent 47d051dd44
commit fbb12ff801
4 changed files with 8 additions and 10 deletions

View File

@ -240,7 +240,7 @@ class _PlayerScreenState extends State<PlayerScreen> {
width: 56, width: 56,
height: 56, height: 56,
child: IconButton.filled( child: IconButton.filled(
icon: _isFetchingActiveTrack icon: (_isFetchingActiveTrack && _isPlaying)
? const SizedBox( ? const SizedBox(
height: 20, height: 20,
width: 20, width: 20,
@ -255,9 +255,7 @@ class _PlayerScreenState extends State<PlayerScreen> {
: Icons.pause, : Icons.pause,
size: 28, size: 28,
), ),
onPressed: _isFetchingActiveTrack onPressed: _togglePlayState,
? null
: _togglePlayState,
), ),
), ),
), ),

View File

@ -25,12 +25,12 @@ class ActiveSourcedTrackProvider extends GetxController {
try { try {
if (state.value == null) return; if (state.value == null) return;
await audioPlayer.pause();
await populateSibling(); await populateSibling();
final newTrack = await state.value!.swapWithSibling(sibling); final newTrack = await state.value!.swapWithSibling(sibling);
if (newTrack == null) return; if (newTrack == null) return;
state.value = newTrack; state.value = newTrack;
await audioPlayer.pause();
final playback = Get.find<AudioPlayerProvider>(); final playback = Get.find<AudioPlayerProvider>();
final oldActiveIndex = audioPlayer.currentIndex; final oldActiveIndex = audioPlayer.currentIndex;
@ -40,12 +40,11 @@ class ActiveSourcedTrackProvider extends GetxController {
await audioPlayer.removeTrack(oldActiveIndex); await audioPlayer.removeTrack(oldActiveIndex);
await playback.jumpToTrack(newTrack); await playback.jumpToTrack(newTrack);
await audioPlayer.resume();
} catch (e, stack) { } catch (e, stack) {
log('[Playback] Failed to swap with siblings. Error: $e; Trace:\n$stack'); log('[Playback] Failed to swap with siblings. Error: $e; Trace:\n$stack');
} finally { } finally {
query.isQueryingTrackInfo.value = false; query.isQueryingTrackInfo.value = false;
await audioPlayer.resume();
} }
} }
} }

View File

@ -47,18 +47,19 @@ class _PlayerControlsState extends State<PlayerControls> {
onPressed: _isFetchingActiveTrack ? null : audioPlayer.skipToNext, onPressed: _isFetchingActiveTrack ? null : audioPlayer.skipToNext,
), ),
IconButton.filled( IconButton.filled(
icon: _isFetchingActiveTrack icon: (_isFetchingActiveTrack && _isPlaying)
? const SizedBox( ? const SizedBox(
height: 20, height: 20,
width: 20, width: 20,
child: CircularProgressIndicator( child: CircularProgressIndicator(
strokeWidth: 3, strokeWidth: 3,
color: Colors.white,
), ),
) )
: Icon( : Icon(
!_isPlaying ? Icons.play_arrow : Icons.pause, !_isPlaying ? Icons.play_arrow : Icons.pause,
), ),
onPressed: _isFetchingActiveTrack ? null : _togglePlayState, onPressed: _togglePlayState,
), ),
if (MediaQuery.of(context).size.width >= 720) if (MediaQuery.of(context).size.width >= 720)
IconButton( IconButton(

View File

@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts # In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix. # of the product and file versions while build-number is used as the build suffix.
version: 1.0.0+1 version: 1.0.0+3
environment: environment:
sdk: ^3.5.0 sdk: ^3.5.0