mirror of
https://github.com/KRTirtho/spotube.git
synced 2025-09-13 07:55:18 +00:00
fixed palette color doesn't change after track change in PlayerView
This commit is contained in:
parent
35912ff228
commit
22a1da06b6
@ -53,10 +53,7 @@ class PlayerOverlay extends HookConsumerWidget {
|
|||||||
child: MouseRegion(
|
child: MouseRegion(
|
||||||
cursor: SystemMouseCursors.click,
|
cursor: SystemMouseCursors.click,
|
||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
onTap: () => GoRouter.of(context).push(
|
onTap: () => GoRouter.of(context).push("/player"),
|
||||||
"/player",
|
|
||||||
extra: paletteColor,
|
|
||||||
),
|
|
||||||
child: PlayerTrackDetails(
|
child: PlayerTrackDetails(
|
||||||
albumArt: albumArt,
|
albumArt: albumArt,
|
||||||
color: paletteColor.bodyTextColor,
|
color: paletteColor.bodyTextColor,
|
||||||
|
@ -10,12 +10,11 @@ import 'package:spotube/components/Shared/PageWindowTitleBar.dart';
|
|||||||
import 'package:spotube/helpers/artists-to-clickable-artists.dart';
|
import 'package:spotube/helpers/artists-to-clickable-artists.dart';
|
||||||
import 'package:spotube/helpers/image-to-url-string.dart';
|
import 'package:spotube/helpers/image-to-url-string.dart';
|
||||||
import 'package:spotube/hooks/useBreakpoints.dart';
|
import 'package:spotube/hooks/useBreakpoints.dart';
|
||||||
|
import 'package:spotube/hooks/usePaletteColor.dart';
|
||||||
import 'package:spotube/provider/Playback.dart';
|
import 'package:spotube/provider/Playback.dart';
|
||||||
|
|
||||||
class PlayerView extends HookConsumerWidget {
|
class PlayerView extends HookConsumerWidget {
|
||||||
final PaletteColor paletteColor;
|
|
||||||
const PlayerView({
|
const PlayerView({
|
||||||
required this.paletteColor,
|
|
||||||
Key? key,
|
Key? key,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
@ -43,6 +42,8 @@ class PlayerView extends HookConsumerWidget {
|
|||||||
[currentTrack?.album?.images],
|
[currentTrack?.album?.images],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
final PaletteColor paletteColor = usePaletteColor(context, albumArt);
|
||||||
|
|
||||||
return SafeArea(
|
return SafeArea(
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
appBar: const PageWindowTitleBar(
|
appBar: const PageWindowTitleBar(
|
||||||
|
@ -3,7 +3,7 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||||
import 'package:palette_generator/palette_generator.dart';
|
import 'package:palette_generator/palette_generator.dart';
|
||||||
|
|
||||||
PaletteColor usePaletteColor(BuildContext context, imageUrl) {
|
PaletteColor usePaletteColor(BuildContext context, String imageUrl) {
|
||||||
final paletteColor =
|
final paletteColor =
|
||||||
useState<PaletteColor>(PaletteColor(Colors.grey[300]!, 0));
|
useState<PaletteColor>(PaletteColor(Colors.grey[300]!, 0));
|
||||||
final mounted = useIsMounted();
|
final mounted = useIsMounted();
|
||||||
|
@ -61,11 +61,8 @@ GoRouter createGoRouter() => GoRouter(
|
|||||||
GoRoute(
|
GoRoute(
|
||||||
path: "/player",
|
path: "/player",
|
||||||
pageBuilder: (context, state) {
|
pageBuilder: (context, state) {
|
||||||
assert(state.extra is PaletteColor);
|
|
||||||
return SpotubePage(
|
return SpotubePage(
|
||||||
child: PlayerView(
|
child: const PlayerView(),
|
||||||
paletteColor: state.extra as PaletteColor,
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user