createRoute method

  1. @override
MaterialPageRoute createRoute(
  1. RouteSettings settings
)
override

Implementation

@override
MaterialPageRoute createRoute(RouteSettings settings) {
  return MaterialPageRoute(
      settings: settings,
      builder: (BuildContext context) {
        final provider = Provider.of(context);
        BaseWidgetState stateWidget = createWidget(settings, provider);
        if (!provider.sharedModel.isAuthorized && !stateWidget.isWhitelist) {
          stateWidget = landingPage(settings, provider);
        }
        final widget = BaseWidget(() => stateWidget);
        provider.sharedModel.routeInfo =
            RouteInfo(widget, stateWidget, settings);
        return widget;
      });
}