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