mirror of
https://github.com/KRTirtho/spotube.git
synced 2025-09-13 07:55:18 +00:00
fix: lyrics not changing on track change
This commit is contained in:
parent
3db28f43b4
commit
c809d2daba
@ -194,7 +194,7 @@ class SpotubeState extends ConsumerState<Spotube> with WidgetsBindingObserver {
|
||||
'height': size.height,
|
||||
}),
|
||||
);
|
||||
prevSize = await windowManager.getSize();
|
||||
prevSize = size;
|
||||
}
|
||||
|
||||
TargetPlatform appPlatform = TargetPlatform.android;
|
||||
|
@ -25,7 +25,7 @@ class GeniusLyrics extends HookConsumerWidget {
|
||||
Widget build(BuildContext context, ref) {
|
||||
Playback playback = ref.watch(playbackProvider);
|
||||
final geniusLyricsQuery = useQuery(
|
||||
job: Queries.lyrics.static,
|
||||
job: Queries.lyrics.static(playback.track?.id ?? ""),
|
||||
externalData: Tuple2(
|
||||
playback.track,
|
||||
ref.watch(userPreferencesProvider).geniusAccessToken,
|
||||
|
@ -70,8 +70,9 @@ class LyricsPage extends HookConsumerWidget {
|
||||
return SafeArea(
|
||||
child: Container(
|
||||
clipBehavior: Clip.hardEdge,
|
||||
decoration: const BoxDecoration(
|
||||
borderRadius: BorderRadius.only(
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).backgroundColor.withOpacity(.4),
|
||||
borderRadius: const BorderRadius.only(
|
||||
topLeft: Radius.circular(10),
|
||||
topRight: Radius.circular(10),
|
||||
),
|
||||
|
@ -38,7 +38,7 @@ class SyncedLyrics extends HookConsumerWidget {
|
||||
Widget build(BuildContext context, ref) {
|
||||
Playback playback = ref.watch(playbackProvider);
|
||||
final timedLyricsQuery = useQuery(
|
||||
job: Queries.lyrics.synced,
|
||||
job: Queries.lyrics.synced(playback.track?.id ?? ""),
|
||||
externalData: playback.track,
|
||||
);
|
||||
final lyricDelay = ref.watch(lyricDelayState);
|
||||
|
@ -7,13 +7,13 @@ import 'package:spotube/utils/service_utils.dart';
|
||||
import 'package:tuple/tuple.dart';
|
||||
|
||||
class LyricsQueries {
|
||||
final static = QueryJob<String, Tuple2<Track?, String>>(
|
||||
queryKey: "genius-lyrics-query",
|
||||
final static = QueryJob.withVariableKey<String, Tuple2<Track?, String>>(
|
||||
preQueryKey: "genius-lyrics-query",
|
||||
refetchOnExternalDataChange: true,
|
||||
task: (_, externalData) async {
|
||||
task: (queryKey, externalData) async {
|
||||
final currentTrack = externalData.item1;
|
||||
final geniusAccessToken = externalData.item2;
|
||||
if (currentTrack == null) {
|
||||
if (currentTrack == null || getVariable(queryKey).isEmpty) {
|
||||
return "“Give this player a track to play”\n- S'Challa";
|
||||
}
|
||||
final lyrics = await ServiceUtils.getLyrics(
|
||||
@ -28,10 +28,12 @@ class LyricsQueries {
|
||||
},
|
||||
);
|
||||
|
||||
final synced = QueryJob<SubtitleSimple, SpotubeTrack?>(
|
||||
queryKey: "synced-lyrics",
|
||||
task: (_, currentTrack) async {
|
||||
if (currentTrack == null) throw "No track currently";
|
||||
final synced = QueryJob.withVariableKey<SubtitleSimple, SpotubeTrack?>(
|
||||
preQueryKey: "synced-lyrics",
|
||||
task: (queryKey, currentTrack) async {
|
||||
if (currentTrack == null || getVariable(queryKey).isEmpty) {
|
||||
throw "No track currently";
|
||||
}
|
||||
|
||||
final timedLyrics = await ServiceUtils.getTimedLyrics(currentTrack);
|
||||
if (timedLyrics == null) throw Exception("Unable to find lyrics");
|
||||
|
@ -56,8 +56,8 @@ ThemeData darkTheme({
|
||||
indicatorColor: accentMaterialColor[300],
|
||||
),
|
||||
navigationBarTheme: NavigationBarThemeData(
|
||||
backgroundColor: backgroundMaterialColor[800],
|
||||
height: 55,
|
||||
backgroundColor: backgroundMaterialColor[900],
|
||||
height: 45,
|
||||
indicatorColor: accentMaterialColor[300],
|
||||
labelBehavior: NavigationDestinationLabelBehavior.alwaysHide,
|
||||
iconTheme: MaterialStateProperty.resolveWith((states) {
|
||||
|
@ -84,8 +84,8 @@ ThemeData lightTheme({
|
||||
),
|
||||
),
|
||||
navigationBarTheme: NavigationBarThemeData(
|
||||
backgroundColor: backgroundMaterialColor[100],
|
||||
height: 55,
|
||||
backgroundColor: backgroundMaterialColor[50],
|
||||
height: 45,
|
||||
indicatorColor: accentMaterialColor[300],
|
||||
iconTheme: MaterialStateProperty.all(
|
||||
IconThemeData(color: Colors.grey[850], size: 18),
|
||||
|
Loading…
Reference in New Issue
Block a user