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 sheetContext) {
    final page = ModalRoute.of(sheetContext)?.settings;
    final shown = page is Fluent2SheetPage ? page.child : child;
    return back ? _BackExit(child: shown) : shown;
  }

  if (fullScreen) {
    return MaterialPageRoute<T>(
      settings: this,
      fullscreenDialog: true,
      builder: (sheetContext) => RoutePresentationScope(
        presentation: RoutePresentation.sheet,
        child: ColoredBox(
          color: sheetContext.fluent2Theme.background,
          child: current(sheetContext),
        ),
      ),
    );
  }
  return Fluent2Sheet.pageRoute<T>(
    context: context,
    settings: this,
    drawer: drawer,
    builder: current,
  );
}