Skip to content

feat: Expose route config#1884

Open
EArminjon wants to merge 1 commit intowidgetbook:mainfrom
EArminjon:feat/expose-route-config
Open

feat: Expose route config#1884
EArminjon wants to merge 1 commit intowidgetbook:mainfrom
EArminjon:feat/expose-route-config

Conversation

@EArminjon
Copy link
Copy Markdown
Contributor

@EArminjon EArminjon commented Mar 26, 2026

As a dev I want to interact with navigation (for example to create a Home button, or a redirection).

onTap: () => Router.of(context).routerDelegate.setNewRoutePath(AppRouteConfig(uri: Uri(path: '/'))),

List of issues which are fixed by the PR

You must list at least one issue.

Screenshots

If applicable, add screenshots to help explain the changes.

Checklist

  • I signed the CLA.
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making].
  • All existing and new tests are passing.

If you need help, consider asking for advice on Discord.

@docs-page
Copy link
Copy Markdown

docs-page bot commented Mar 26, 2026

To view this pull requests documentation preview, visit the following URL:

docs.page/widgetbook/widgetbook~1884

Documentation is deployed and generated using docs.page.

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 26, 2026

@EArminjon is attempting to deploy a commit to the Widgetbook Team on Vercel.

A member of the Team first needs to authorize it.

@EArminjon EArminjon force-pushed the feat/expose-route-config branch from f6875f0 to 065f639 Compare March 26, 2026 13:50
@EArminjon EArminjon force-pushed the feat/expose-route-config branch from 065f639 to 11f2a45 Compare March 26, 2026 14:09
@EArminjon
Copy link
Copy Markdown
Contributor Author

EArminjon commented Apr 3, 2026

Hum, maybe we can create a new function to call both 'setNewRoutePath' and 'updatePath()'. UpdatePath should be call to ensure that knobs panel are well closed if needed.

We use actually the bellow code (not very beautiful)

// ignore: implementation_imports https://github.com/widgetbook/widgetbook/pull/1884
import 'package:widgetbook/src/routing/routing.dart';
import 'package:widgetbook/widgetbook.dart';
...
// ignore: invalid_use_of_internal_member needed to clear knobs & panels
WidgetbookState.of(context).updatePath('/');
Router.of(context).routerDelegate.setNewRoutePath(AppRouteConfig(uri: Uri(path: '/')));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant