🐛 Bug fixes on loading state

This commit is contained in:
LittleSheep 2024-08-27 23:14:54 +08:00
parent c6b460315f
commit 2751ab1296
2 changed files with 8 additions and 3 deletions

View File

@ -59,11 +59,12 @@ class MyApp extends StatelessWidget {
void _initializeProviders(BuildContext context) async { void _initializeProviders(BuildContext context) async {
Get.lazyPut(() => SpotifyProvider()); Get.lazyPut(() => SpotifyProvider());
Get.put(DatabaseProvider());
Get.put(AudioPlayerProvider()); Get.put(AudioPlayerProvider());
Get.put(ActiveSourcedTrackProvider()); Get.put(ActiveSourcedTrackProvider());
Get.put(AudioPlayerStreamProvider()); Get.put(AudioPlayerStreamProvider());
Get.put(DatabaseProvider());
Get.put(PlaybackHistoryProvider()); Get.put(PlaybackHistoryProvider());
Get.put(SegmentsProvider()); Get.put(SegmentsProvider());
Get.put(PaletteProvider()); Get.put(PaletteProvider());

View File

@ -26,9 +26,13 @@ class SourcedTrackProvider extends GetxController {
} }
}); });
query.isQueryingTrackInfo.value = true; final isCurrentTrack = playback.state.value.activeTrack?.id == track.id;
if (isCurrentTrack) query.isQueryingTrackInfo.value = true;
sourcedTrack.value = await SourcedTrack.fetchFromTrack(track: track); sourcedTrack.value = await SourcedTrack.fetchFromTrack(track: track);
query.isQueryingTrackInfo.value = false;
if (isCurrentTrack) query.isQueryingTrackInfo.value = false;
return sourcedTrack.value; return sourcedTrack.value;
} }