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(
|
||||
cursor: SystemMouseCursors.click,
|
||||
child: GestureDetector(
|
||||
onTap: () => GoRouter.of(context).push(
|
||||
"/player",
|
||||
extra: paletteColor,
|
||||
),
|
||||
onTap: () => GoRouter.of(context).push("/player"),
|
||||
child: PlayerTrackDetails(
|
||||
albumArt: albumArt,
|
||||
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/image-to-url-string.dart';
|
||||
import 'package:spotube/hooks/useBreakpoints.dart';
|
||||
import 'package:spotube/hooks/usePaletteColor.dart';
|
||||
import 'package:spotube/provider/Playback.dart';
|
||||
|
||||
class PlayerView extends HookConsumerWidget {
|
||||
final PaletteColor paletteColor;
|
||||
const PlayerView({
|
||||
required this.paletteColor,
|
||||
Key? key,
|
||||
}) : super(key: key);
|
||||
|
||||
@ -43,6 +42,8 @@ class PlayerView extends HookConsumerWidget {
|
||||
[currentTrack?.album?.images],
|
||||
);
|
||||
|
||||
final PaletteColor paletteColor = usePaletteColor(context, albumArt);
|
||||
|
||||
return SafeArea(
|
||||
child: Scaffold(
|
||||
appBar: const PageWindowTitleBar(
|
||||
|
@ -3,7 +3,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
import 'package:palette_generator/palette_generator.dart';
|
||||
|
||||
PaletteColor usePaletteColor(BuildContext context, imageUrl) {
|
||||
PaletteColor usePaletteColor(BuildContext context, String imageUrl) {
|
||||
final paletteColor =
|
||||
useState<PaletteColor>(PaletteColor(Colors.grey[300]!, 0));
|
||||
final mounted = useIsMounted();
|
||||
|
@ -61,11 +61,8 @@ GoRouter createGoRouter() => GoRouter(
|
||||
GoRoute(
|
||||
path: "/player",
|
||||
pageBuilder: (context, state) {
|
||||
assert(state.extra is PaletteColor);
|
||||
return SpotubePage(
|
||||
child: PlayerView(
|
||||
paletteColor: state.extra as PaletteColor,
|
||||
),
|
||||
child: const PlayerView(),
|
||||
);
|
||||
},
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user