diff --git a/lib/components/Player/PlayerOverlay.dart b/lib/components/Player/PlayerOverlay.dart index 351d22d2..1490ad89 100644 --- a/lib/components/Player/PlayerOverlay.dart +++ b/lib/components/Player/PlayerOverlay.dart @@ -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, diff --git a/lib/components/Player/PlayerView.dart b/lib/components/Player/PlayerView.dart index 36ff7756..a60960db 100644 --- a/lib/components/Player/PlayerView.dart +++ b/lib/components/Player/PlayerView.dart @@ -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( diff --git a/lib/hooks/usePaletteColor.dart b/lib/hooks/usePaletteColor.dart index 6e19c8e1..b6cebd5a 100644 --- a/lib/hooks/usePaletteColor.dart +++ b/lib/hooks/usePaletteColor.dart @@ -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(Colors.grey[300]!, 0)); final mounted = useIsMounted(); diff --git a/lib/models/GoRouteDeclarations.dart b/lib/models/GoRouteDeclarations.dart index 3a871a10..4b503928 100644 --- a/lib/models/GoRouteDeclarations.dart +++ b/lib/models/GoRouteDeclarations.dart @@ -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(), ); }, )