defaultPageBuilder function

Page defaultPageBuilder(
  1. BuildContext context,
  2. PageWrapper pageWrapper
)

Default page builder.

If widget implements RouteDialogBehavior it builds a DialogPage, in another case it build a MaterialPage.

Implementation

Page defaultPageBuilder(
  BuildContext context,
  PageWrapper pageWrapper,
) {
  Widget widget = pageWrapper.buildWidget(context);

  if (widget is RouteDialogBehavior) {
    return DialogPage(
      key: ValueKey(pageWrapper.key),
      restorationId: pageWrapper.restorationId,
      name: pageWrapper.name,
      arguments: {
        'path': pageWrapper.path,
        'parameters': pageWrapper.parameters,
      },
      child: widget,
    );
  }

  return MaterialPage(
    key: ValueKey(pageWrapper.key),
    restorationId: pageWrapper.restorationId,
    name: pageWrapper.name,
    arguments: {
      'path': pageWrapper.path,
      'parameters': pageWrapper.parameters,
    },
    child: widget,
  );
}