createMaterialWidget method

  1. @override
MaterialApp createMaterialWidget(
  1. BuildContext context
)
override

Implementation

@override
createMaterialWidget(BuildContext context) {
  final dataRouter = materialRouter?.call(context, platform(context));

  if (routeInformationParser != null ||
      dataRouter?.routeInformationParser != null ||
      routerConfig != null ||
      dataRouter?.routerConfig != null) {
    assert(dataRouter?.routerDelegate != null ||
        routerDelegate != null ||
        dataRouter?.routerConfig != null ||
        routerConfig != null);

    return MaterialApp.router(
      routeInformationProvider:
          dataRouter?.routeInformationProvider ?? routeInformationProvider,
      routeInformationParser:
          dataRouter?.routeInformationParser ?? routeInformationParser,
      routerDelegate: dataRouter?.routerDelegate ?? routerDelegate,
      routerConfig: dataRouter?.routerConfig ?? routerConfig,
      backButtonDispatcher:
          dataRouter?.backButtonDispatcher ?? backButtonDispatcher,
      builder: dataRouter?.builder ?? builder,
      title: dataRouter?.title ?? title ?? '',
      onGenerateTitle: dataRouter?.onGenerateTitle ?? onGenerateTitle,
      color: dataRouter?.color ?? color,
      theme: (dataRouter?.theme ??
              _getMaterialLightThemeData(context) ??
              Theme.of(context))
          .copyWith(platform: TargetPlatform.android),
      darkTheme: (dataRouter?.darkTheme ?? _getMaterialDarkThemeData(context))
          ?.copyWith(platform: TargetPlatform.android),
      themeMode: dataRouter?.themeMode ??
          _getMaterialThemeMode(context) ??
          ThemeMode.system,
      highContrastDarkTheme: dataRouter?.highContrastDarkTheme,
      highContrastTheme: dataRouter?.highContrastTheme,
      locale: dataRouter?.locale ?? locale,
      localizationsDelegates:
          dataRouter?.localizationsDelegates ?? localizationsDelegates,
      localeListResolutionCallback:
          dataRouter?.localeListResolutionCallback ??
              localeListResolutionCallback,
      localeResolutionCallback:
          dataRouter?.localeResolutionCallback ?? localeResolutionCallback,
      supportedLocales: dataRouter?.supportedLocales ??
          supportedLocales ??
          const <Locale>[Locale('en', 'US')],
      debugShowMaterialGrid: dataRouter?.debugShowMaterialGrid ?? false,
      showPerformanceOverlay: dataRouter?.showPerformanceOverlay ??
          showPerformanceOverlay ??
          false,
      checkerboardRasterCacheImages:
          dataRouter?.checkerboardRasterCacheImages ??
              checkerboardRasterCacheImages ??
              false,
      checkerboardOffscreenLayers: dataRouter?.checkerboardOffscreenLayers ??
          checkerboardOffscreenLayers ??
          false,
      showSemanticsDebugger:
          dataRouter?.showSemanticsDebugger ?? showSemanticsDebugger ?? false,
      debugShowCheckedModeBanner: dataRouter?.debugShowCheckedModeBanner ??
          debugShowCheckedModeBanner ??
          true,
      shortcuts: dataRouter?.shortcuts ?? shortcuts,
      actions: dataRouter?.actions ?? actions,
      key: dataRouter?.widgetKey ?? widgetKey,
      restorationScopeId:
          dataRouter?.restorationScopeId ?? restorationScopeId,
      scaffoldMessengerKey: dataRouter?.scaffoldMessengerKey,
      scrollBehavior: dataRouter?.scrollBehavior ?? scrollBehavior,
      themeAnimationCurve: dataRouter?.themeAnimationCurve ?? Curves.linear,
      themeAnimationDuration:
          dataRouter?.themeAnimationDuration ?? kThemeAnimationDuration,
      onNavigationNotification:
          dataRouter?.onNavigationNotification ?? onNavigationNotification,
      // useInheritedMediaQuery: , Deprecated
    );
  } else {
    final data = material?.call(context, platform(context));
    return MaterialApp(
      key: data?.widgetKey ?? widgetKey,
      navigatorKey: data?.navigatorKey ?? navigatorKey,
      home: data?.home ?? home,
      routes: data?.routes ?? routes ?? const <String, WidgetBuilder>{},
      initialRoute: data?.initialRoute ?? initialRoute,
      onGenerateRoute: data?.onGenerateRoute ?? onGenerateRoute,
      onUnknownRoute: data?.onUnknownRoute ?? onUnknownRoute,
      navigatorObservers: data?.navigatorObservers ??
          navigatorObservers ??
          const <NavigatorObserver>[],
      builder: data?.builder ?? builder,
      title: data?.title ?? title ?? '',
      onGenerateTitle: data?.onGenerateTitle ?? onGenerateTitle,
      color: data?.color ?? color,
      locale: data?.locale ?? locale,
      localizationsDelegates:
          data?.localizationsDelegates ?? localizationsDelegates,
      localeListResolutionCallback:
          data?.localeListResolutionCallback ?? localeListResolutionCallback,
      localeResolutionCallback:
          data?.localeResolutionCallback ?? localeResolutionCallback,
      supportedLocales: data?.supportedLocales ??
          supportedLocales ??
          const <Locale>[Locale('en', 'US')],
      showPerformanceOverlay:
          data?.showPerformanceOverlay ?? showPerformanceOverlay ?? false,
      checkerboardRasterCacheImages: data?.checkerboardRasterCacheImages ??
          checkerboardRasterCacheImages ??
          false,
      checkerboardOffscreenLayers: data?.checkerboardOffscreenLayers ??
          checkerboardOffscreenLayers ??
          false,
      showSemanticsDebugger:
          data?.showSemanticsDebugger ?? showSemanticsDebugger ?? false,
      debugShowCheckedModeBanner: data?.debugShowCheckedModeBanner ??
          debugShowCheckedModeBanner ??
          true,
      debugShowMaterialGrid: data?.debugShowMaterialGrid ?? false,
      theme: (data?.theme ??
              _getMaterialLightThemeData(context) ??
              Theme.of(context))
          .copyWith(platform: TargetPlatform.android),
      darkTheme: (dataRouter?.darkTheme ?? _getMaterialDarkThemeData(context))
          ?.copyWith(platform: TargetPlatform.android),
      themeMode: data?.themeMode ??
          _getMaterialThemeMode(context) ??
          ThemeMode.system,
      shortcuts: data?.shortcuts ?? shortcuts,
      actions: data?.actions ?? actions,
      onGenerateInitialRoutes:
          data?.onGenerateInitialRoutes ?? onGenerateInitialRoutes,
      highContrastDarkTheme: data?.highContrastDarkTheme,
      highContrastTheme: data?.highContrastTheme,
      restorationScopeId: data?.restorationScopeId ?? restorationScopeId,
      scaffoldMessengerKey: data?.scaffoldMessengerKey,
      scrollBehavior: data?.scrollBehavior ?? scrollBehavior,
      themeAnimationCurve: data?.themeAnimationCurve ?? Curves.linear,
      themeAnimationDuration:
          data?.themeAnimationDuration ?? kThemeAnimationDuration,
      onNavigationNotification:
          data?.onNavigationNotification ?? onNavigationNotification,
      // useInheritedMediaQuery: , Deprecated
    );
  }
}