Skip to content

Commit

Permalink
Handle /:gistId route (#3096)
Browse files Browse the repository at this point in the history
Resolves #3088
  • Loading branch information
johnpryan authored Nov 19, 2024
1 parent f1f0748 commit 2ce90bf
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions pkgs/dartpad_ui/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,9 @@ class _DartPadAppState extends State<DartPadApp> {
builder: _homePageBuilder,
),
GoRoute(
path: '/flutter',
builder: _homePageBuilder,
path: '/:gistId',
builder: (context, state) => _homePageBuilder(context, state,
gist: state.pathParameters['gistId']),
),
],
);
Expand Down Expand Up @@ -116,9 +117,10 @@ class _DartPadAppState extends State<DartPadApp> {
});
}

Widget _homePageBuilder(BuildContext context, GoRouterState state) {
Widget _homePageBuilder(BuildContext context, GoRouterState state,
{String? gist}) {
final path = state.path;
final gistId = state.uri.queryParameters['id'];
final gistId = gist ?? state.uri.queryParameters['id'];
final builtinSampleId = state.uri.queryParameters['sample'];
final flutterSampleId = state.uri.queryParameters['sample_id'];
final channelParam = state.uri.queryParameters['channel'];
Expand Down

0 comments on commit 2ce90bf

Please sign in to comment.