createRoute method

  1. @override
Route<T> createRoute(
  1. BuildContext context
)
override

Creates the Route that corresponds to this page.

The created Route must have its Route.settings property set to this Page.

Implementation

@override
Route<T> createRoute(BuildContext context) {
  Widget current(BuildContext context) {
    // The page as it stands now: a router that updates it in place hands
    // the route the new one.
    final page = ModalRoute.of(context)?.settings;
    return ColoredBox(
      color: StudioTheme.of(context).colors.panel,
      child: page is StudioPage ? page.child : child,
    );
  }

  return _StudioPageRoute<T>(
    settings: this,
    fullscreenDialog: fullscreenDialog,
    builder: current,
  );
}