createMaterialWidget method
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 ?? Theme.of(context))
.copyWith(platform: TargetPlatform.android),
darkTheme:
dataRouter?.darkTheme?.copyWith(platform: TargetPlatform.android),
highContrastDarkTheme: dataRouter?.highContrastDarkTheme,
highContrastTheme: dataRouter?.highContrastTheme,
themeMode: dataRouter?.themeMode ?? ThemeMode.system,
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,
useInheritedMediaQuery: dataRouter?.useInheritedMediaQuery ??
useInheritedMediaQuery ??
false,
);
} 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,
theme: (data?.theme ?? Theme.of(context))
.copyWith(platform: TargetPlatform.android),
debugShowMaterialGrid: data?.debugShowMaterialGrid ?? false,
darkTheme: data?.darkTheme?.copyWith(platform: TargetPlatform.android),
themeMode: data?.themeMode ?? 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,
useInheritedMediaQuery:
data?.useInheritedMediaQuery ?? useInheritedMediaQuery ?? false,
);
}
}