fix(flutter): full player kebab Go to album/artist navigates cleanly
Same root cause as the /queue duplicate-page-key crash: /now-playing is a top-level route (lives outside the ShellRoute), but /artists/:id and /albums/:id are shell-children. Pushing a shell- child from a top-level route makes go_router attempt to mount a second ShellRoute on top of the active one, leaving navigation in a broken state. The mini player works because it's already inside the shell. Add an optional onBeforeNavigate callback to TrackActionsSheet (forwarded through TrackActionsButton). When set, fires after sheet.pop() and before context.push() of the destination route. Wire the full player's TrackActionsButton with onBeforeNavigate: () => Navigator.of(context).maybePop() so /now-playing dismisses itself before the detail route is pushed. Result: clean navigation into the destination, mini player visible underneath as expected. Mini player keeps the default (no callback) since it's already in the shell.
This commit is contained in:
@@ -397,6 +397,12 @@ class _SecondaryControls extends StatelessWidget {
|
||||
streamUrl: '',
|
||||
),
|
||||
hideQueueActions: true,
|
||||
// /now-playing lives outside the ShellRoute. Pushing
|
||||
// /artists/:id or /albums/:id (both shell-children) on top
|
||||
// of it would make go_router try to mount a duplicate
|
||||
// ShellRoute. Pop ourselves first so the destination route
|
||||
// mounts cleanly inside the existing shell.
|
||||
onBeforeNavigate: () => Navigator.of(context).maybePop(),
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user