buildApp method
Override to impose your own WidgetsApp (like CupertinoApp or MaterialApp)
Implementation
@override
Widget buildApp(BuildContext context) {
//
Widget app;
_routerDelegate = routerDelegate ?? onRouterDelegate();
_routeInformationParser =
routeInformationParser ?? onRouteInformationParser();
// Supply the appropriate parser for the developer.
if (_routerDelegate is v.AppRouterDelegate &&
_routeInformationParser == null) {
_routeInformationParser = v.AppRouteInformationParser();
}
if (useCupertino!) {
//
if (_routerDelegate == null || _routeInformationParser == null) {
//
app = CupertinoApp(
key: key ?? cupertinoKey,
navigatorKey: navigatorKey ?? onNavigatorKey(),
routes: routes ?? onRoutes() ?? const <String, WidgetBuilder>{},
initialRoute: initialRoute ?? onInitialRoute(),
onGenerateRoute: onGenerateRoute ?? onOnGenerateRoute(),
onUnknownRoute: onUnknownRoute ?? onOnUnknownRoute(),
navigatorObservers: navigatorObservers ??
onNavigatorObservers() ??
const <NavigatorObserver>[],
builder: builder ?? onBuilder(),
title: title = onTitle(),
onGenerateTitle: onGenerateTitle ?? onOnGenerateTitle(context),
color: color ?? onColor() ?? Colors.blue,
theme: v.App.iOSTheme ??= iOSTheme ?? oniOSTheme(),
locale: locale ?? onLocale(),
localizationsDelegates:
localizationsDelegates ?? onLocalizationsDelegates(),
localeListResolutionCallback:
localeListResolutionCallback ?? onLocaleListResolutionCallback(),
localeResolutionCallback:
localeResolutionCallback ?? onLocaleResolutionCallback(),
supportedLocales: supportedLocales ?? onSupportedLocales(),
showPerformanceOverlay:
showPerformanceOverlay ?? onShowPerformanceOverlay(),
checkerboardRasterCacheImages: checkerboardRasterCacheImages ??
onCheckerboardRasterCacheImages(),
checkerboardOffscreenLayers:
checkerboardOffscreenLayers ?? onCheckerboardOffscreenLayers(),
showSemanticsDebugger:
showSemanticsDebugger ?? onShowSemanticsDebugger(),
debugShowCheckedModeBanner:
debugShowCheckedModeBanner ?? onDebugShowCheckedModeBanner(),
shortcuts: shortcuts ?? onShortcuts(),
actions: actions ?? onActions(),
restorationScopeId: restorationScopeId ?? onRestorationScopeId(),
scrollBehavior: scrollBehavior ?? onScrollBehavior(),
useInheritedMediaQuery:
useInheritedMediaQuery ?? onInheritedMediaQuery(),
// Let the parameters run before the home parameter.
home: home ?? onHome(),
);
} else {
//
app = CupertinoApp.router(
key: key ?? cupertinoKey,
routeInformationProvider:
routeInformationProvider ?? onRouteInformationProvider(),
routeInformationParser: _routeInformationParser!,
routerDelegate: _routerDelegate!,
theme: v.App.iOSTheme ??= iOSTheme ?? oniOSTheme(),
builder: builder ?? onBuilder(),
title: title = onTitle(),
onGenerateTitle: onGenerateTitle ?? onOnGenerateTitle(context),
color: color ?? onColor() ?? Colors.blue,
locale: locale ?? onLocale(),
localizationsDelegates:
localizationsDelegates ?? onLocalizationsDelegates(),
localeListResolutionCallback:
localeListResolutionCallback ?? onLocaleListResolutionCallback(),
localeResolutionCallback:
localeResolutionCallback ?? onLocaleResolutionCallback(),
supportedLocales: supportedLocales ?? onSupportedLocales(),
showPerformanceOverlay:
showPerformanceOverlay ?? onShowPerformanceOverlay(),
checkerboardRasterCacheImages: checkerboardRasterCacheImages ??
onCheckerboardRasterCacheImages(),
checkerboardOffscreenLayers:
checkerboardOffscreenLayers ?? onCheckerboardOffscreenLayers(),
showSemanticsDebugger:
showSemanticsDebugger ?? onShowSemanticsDebugger(),
debugShowCheckedModeBanner:
debugShowCheckedModeBanner ?? onDebugShowCheckedModeBanner(),
shortcuts: shortcuts ?? onShortcuts(),
actions: actions ?? onActions(),
restorationScopeId: restorationScopeId ?? onRestorationScopeId(),
scrollBehavior: scrollBehavior ?? onScrollBehavior(),
useInheritedMediaQuery:
useInheritedMediaQuery ?? onInheritedMediaQuery(),
);
}
} else {
//
if (_routerDelegate == null || _routeInformationParser == null) {
app = MaterialApp(
key: key ?? materialKey,
navigatorKey: navigatorKey ?? onNavigatorKey(),
scaffoldMessengerKey:
scaffoldMessengerKey ?? onScaffoldMessengerKey(),
routes: routes ?? onRoutes() ?? const <String, WidgetBuilder>{},
initialRoute: initialRoute ?? onInitialRoute(),
onGenerateRoute: onGenerateRoute ?? onOnGenerateRoute(),
onUnknownRoute: onUnknownRoute ?? onOnUnknownRoute(),
navigatorObservers: navigatorObservers ??
onNavigatorObservers() ??
const <NavigatorObserver>[],
builder: builder ?? onBuilder(),
title: title = onTitle(),
onGenerateTitle: onGenerateTitle ?? onOnGenerateTitle(context),
color: color ?? onColor() ?? Colors.white,
theme: v.App.themeData ??= theme ?? onTheme(),
darkTheme: darkTheme ?? onDarkTheme(),
themeMode: themeMode ?? onThemeMode(),
locale: locale ?? onLocale(),
localizationsDelegates: onLocalizationsDelegates(),
localeListResolutionCallback:
localeListResolutionCallback ?? onLocaleListResolutionCallback(),
localeResolutionCallback:
localeResolutionCallback ?? onLocaleResolutionCallback(),
supportedLocales: supportedLocales ?? onSupportedLocales(),
debugShowMaterialGrid:
debugShowMaterialGrid ?? onDebugShowMaterialGrid(),
showPerformanceOverlay:
showPerformanceOverlay ?? onShowPerformanceOverlay(),
checkerboardRasterCacheImages: checkerboardRasterCacheImages ??
onCheckerboardRasterCacheImages(),
checkerboardOffscreenLayers:
checkerboardOffscreenLayers ?? onCheckerboardOffscreenLayers(),
showSemanticsDebugger:
showSemanticsDebugger ?? onShowSemanticsDebugger(),
debugShowCheckedModeBanner:
debugShowCheckedModeBanner ?? onDebugShowCheckedModeBanner(),
shortcuts: shortcuts ?? onShortcuts(),
actions: actions ?? onActions(),
restorationScopeId: restorationScopeId ?? onRestorationScopeId(),
scrollBehavior: scrollBehavior ?? onScrollBehavior(),
useInheritedMediaQuery:
useInheritedMediaQuery ?? onInheritedMediaQuery(),
// Let the parameters run before the home parameter.
home: home ?? onHome(),
);
} else {
app = MaterialApp.router(
key: key ?? materialKey,
backButtonDispatcher:
backButtonDispatcher ?? onBackButtonDispatcher(),
scaffoldMessengerKey:
scaffoldMessengerKey ?? onScaffoldMessengerKey(),
builder: builder ?? onBuilder(),
title: title = onTitle(),
onGenerateTitle: onGenerateTitle ?? onOnGenerateTitle(context),
color: color ?? onColor() ?? Colors.white,
theme: v.App.themeData ??= theme ?? onTheme(),
darkTheme: darkTheme ?? onDarkTheme(),
themeMode: themeMode ?? onThemeMode(),
locale: locale ?? onLocale(),
localizationsDelegates: onLocalizationsDelegates(),
localeListResolutionCallback:
localeListResolutionCallback ?? onLocaleListResolutionCallback(),
localeResolutionCallback:
localeResolutionCallback ?? onLocaleResolutionCallback(),
supportedLocales: supportedLocales ?? onSupportedLocales(),
debugShowMaterialGrid:
debugShowMaterialGrid ?? onDebugShowMaterialGrid(),
showPerformanceOverlay:
showPerformanceOverlay ?? onShowPerformanceOverlay(),
checkerboardRasterCacheImages: checkerboardRasterCacheImages ??
onCheckerboardRasterCacheImages(),
checkerboardOffscreenLayers:
checkerboardOffscreenLayers ?? onCheckerboardOffscreenLayers(),
showSemanticsDebugger:
showSemanticsDebugger ?? onShowSemanticsDebugger(),
debugShowCheckedModeBanner:
debugShowCheckedModeBanner ?? onDebugShowCheckedModeBanner(),
shortcuts: shortcuts ?? onShortcuts(),
actions: actions ?? onActions(),
restorationScopeId: restorationScopeId ?? onRestorationScopeId(),
scrollBehavior: scrollBehavior ?? onScrollBehavior(),
useInheritedMediaQuery:
useInheritedMediaQuery ?? onInheritedMediaQuery(),
routeInformationProvider:
routeInformationProvider ?? onRouteInformationProvider(),
routeInformationParser: _routeInformationParser!,
routerDelegate: _routerDelegate!,
);
}
}
// The theme may not have been set. This property must have a value.
// Assign Flutter's current theme default
v.App.themeData ??= ThemeData.light();
// Supply the iOS theme if necessary.
v.App.iOSTheme ??=
MaterialBasedCupertinoThemeData(materialTheme: v.App.themeData!);
return app;
}