buildIn method
Override to impose your own WidgetsApp (like CupertinoApp or MaterialApp)
Implementation
@override
Widget buildIn(BuildContext context) {
//
Widget app;
assert(() {
/// Highlights UI while debugging.
debug.debugPaintSizeEnabled = debugPaintSizeEnabled ?? false;
debug.debugPaintBaselinesEnabled = debugPaintBaselinesEnabled ?? false;
debug.debugPaintPointersEnabled = debugPaintPointersEnabled ?? false;
debug.debugPaintLayerBordersEnabled =
debugPaintLayerBordersEnabled ?? false;
debug.debugRepaintRainbowEnabled = debugRepaintRainbowEnabled ?? false;
debug.debugRepaintTextRainbowEnabled =
debugRepaintTextRainbowEnabled ?? false;
return true;
}());
final _routerDelegate = routerDelegate ?? onRouterDelegate();
// final _routerConfig = routerConfig ?? onRouterConfig();
final _routeInformationParser =
routeInformationParser ?? onRouteInformationParser();
// // Supply the appropriate parser for the developer.
// if (_routerDelegate is AppRouterDelegate &&
// _routeInformationParser == null) {
// _routeInformationParser = AppInformationParser();
// }
final _useRouter = useRouter ?? false;
// Locale must explicitly be assigned to Get.locale as well.
final _locale = onLocale() ?? locale;
// Assign the appropriate Locale to the App's locale
locale = _locale;
// Locale must explicitly be assigned to Get.locale as well.
Get.locale = _locale;
if (useCupertino!) {
// A CupertinoApp object has been supplied.
if (cupertinoApp != null) {
app = cupertinoApp!;
//
} else if (_routerDelegate == null && !_useRouter) {
// && _routerConfig == null) {
//
app = GetCupertinoApp(
key: key ?? cupertinoKey,
navigatorKey: App.navigatorKey,
routes: routes ?? onRoutes() ?? const <String, WidgetBuilder>{},
initialRoute: initialRoute ?? onInitialRoute(),
onGenerateRoute: onGenerateRoute ?? onOnGenerateRoute(),
onUnknownRoute: onUnknownRoute ?? onOnUnknownRoute(),
navigatorObservers: _navigatorObservers(),
builder: builder ?? onBuilder(),
title: title = onTitle(), // Important to assign an empty string
onGenerateTitle: onGenerateTitle ?? onOnGenerateTitle(context),
color: color ?? onColor() ?? Colors.blue,
theme: _iosThemeData(),
locale: _locale,
localizationsDelegates:
localizationsDelegates ?? onLocalizationsDelegates(),
localeListResolutionCallback:
localeListResolutionCallback ?? onLocaleListResolutionCallback,
localeResolutionCallback:
localeResolutionCallback ?? onLocaleResolutionCallback,
supportedLocales: App.supportedLocales = supportedLocales ??
onSupportedLocales() ??
const <Locale>[Locale('en', 'US')],
showPerformanceOverlay:
showPerformanceOverlay ?? onShowPerformanceOverlay() ?? false,
checkerboardRasterCacheImages: checkerboardRasterCacheImages ??
onCheckerboardRasterCacheImages() ??
false,
checkerboardOffscreenLayers: checkerboardOffscreenLayers ??
onCheckerboardOffscreenLayers() ??
false,
showSemanticsDebugger:
showSemanticsDebugger ?? onShowSemanticsDebugger() ?? false,
debugShowCheckedModeBanner: debugShowCheckedModeBanner ??
onDebugShowCheckedModeBanner() ??
false,
shortcuts: shortcuts ?? onShortcuts(),
actions: actions ?? onActions(),
customTransition: customTransition,
translationsKeys: translationsKeys,
translations: translations,
textDirection: textDirection,
fallbackLocale: fallbackLocale,
routingCallback: routingCallback,
defaultTransition: defaultTransition,
opaqueRoute: opaqueRoute,
onInit: onInit,
onReady: onReady,
onDispose: onDispose,
enableLog: enableLog ?? kDebugMode,
logWriterCallback: logWriterCallback,
popGesture: popGesture,
smartManagement: smartManagement ?? SmartManagement.full,
initialBinding: initialBinding,
transitionDuration: transitionDuration,
defaultGlobalState: defaultGlobalState,
getPages: getPages,
unknownRoute: unknownRoute,
// restorationScopeId: restorationScopeId ?? onRestorationScopeId(),
// scrollBehavior: scrollBehavior ?? onScrollBehavior(),
useInheritedMediaQuery:
useInheritedMediaQuery ?? onInheritedMediaQuery() ?? false,
// Let the parameters run before the home parameter.
home: home ?? onHome(),
);
} else {
//
app = GetCupertinoApp.router(
key: key ?? cupertinoKey,
theme: _iosThemeData(),
routeInformationProvider:
routeInformationProvider ?? onRouteInformationProvider(),
routeInformationParser: _routeInformationParser,
routerDelegate: _routerDelegate,
backButtonDispatcher:
backButtonDispatcher ?? onBackButtonDispatcher(),
builder: builder ?? onBuilder(),
title: title = onTitle(),
onGenerateTitle: onGenerateTitle ?? onOnGenerateTitle(context),
useInheritedMediaQuery:
useInheritedMediaQuery ?? onInheritedMediaQuery() ?? false,
color: color ?? onColor() ?? Colors.blue,
highContrastTheme: highContrastTheme,
highContrastDarkTheme: highContrastDarkTheme,
locale: _locale,
localizationsDelegates:
localizationsDelegates ?? onLocalizationsDelegates(),
localeListResolutionCallback:
localeListResolutionCallback ?? onLocaleListResolutionCallback,
localeResolutionCallback:
localeResolutionCallback ?? onLocaleResolutionCallback,
supportedLocales: App.supportedLocales = supportedLocales ??
onSupportedLocales() ??
const <Locale>[Locale('en', 'US')],
showPerformanceOverlay:
showPerformanceOverlay ?? onShowPerformanceOverlay() ?? false,
checkerboardRasterCacheImages: checkerboardRasterCacheImages ??
onCheckerboardRasterCacheImages() ??
false,
checkerboardOffscreenLayers: checkerboardOffscreenLayers ??
onCheckerboardOffscreenLayers() ??
false,
showSemanticsDebugger:
showSemanticsDebugger ?? onShowSemanticsDebugger() ?? false,
debugShowCheckedModeBanner: debugShowCheckedModeBanner ??
onDebugShowCheckedModeBanner() ??
false,
shortcuts: shortcuts ?? onShortcuts(),
actions: actions ?? onActions(),
customTransition: customTransition,
translationsKeys: translationsKeys,
translations: translations,
textDirection: textDirection,
fallbackLocale: fallbackLocale,
routingCallback: routingCallback,
defaultTransition: defaultTransition,
opaqueRoute: opaqueRoute,
onInit: onInit,
onReady: onReady,
onDispose: onDispose,
enableLog: enableLog ?? kDebugMode,
logWriterCallback: logWriterCallback,
popGesture: popGesture,
smartManagement: smartManagement ?? SmartManagement.full,
initialBinding: initialBinding,
transitionDuration: transitionDuration,
defaultGlobalState: defaultGlobalState,
getPages: getPages,
unknownRoute: unknownRoute,
// routerConfig: _routerConfig,
// restorationScopeId: restorationScopeId ?? onRestorationScopeId(),
// scrollBehavior: scrollBehavior ?? onScrollBehavior(),
);
}
} else {
// A MaterialApp object has been supplied.
if (materialApp != null) {
app = materialApp!;
//
} else if (_routerDelegate == null && !_useRouter) {
// && _routerConfig == null) {
//
app = GetMaterialApp(
key: key ?? materialKey,
navigatorKey: App.navigatorKey,
scaffoldMessengerKey:
scaffoldMessengerKey ?? onScaffoldMessengerKey(),
routes: routes ?? onRoutes() ?? const <String, WidgetBuilder>{},
initialRoute: initialRoute ?? onInitialRoute(),
onGenerateRoute: onGenerateRoute ?? onOnGenerateRoute(),
onUnknownRoute: onUnknownRoute ?? onOnUnknownRoute(),
navigatorObservers: _navigatorObservers(),
builder: builder ?? onBuilder(),
title: title = onTitle(),
onGenerateTitle: onGenerateTitle ?? onOnGenerateTitle(context),
color: color ?? onColor() ?? Colors.white,
theme: _themeData(),
darkTheme: darkTheme ?? onDarkTheme(),
themeMode: themeMode ?? onThemeMode() ?? ThemeMode.system,
locale: _locale,
localizationsDelegates: onLocalizationsDelegates(),
localeListResolutionCallback:
localeListResolutionCallback ?? onLocaleListResolutionCallback,
localeResolutionCallback:
localeResolutionCallback ?? onLocaleResolutionCallback,
supportedLocales: App.supportedLocales = supportedLocales ??
onSupportedLocales() ??
const <Locale>[Locale('en', 'US')],
debugShowMaterialGrid:
debugShowMaterialGrid ?? onDebugShowMaterialGrid() ?? false,
showPerformanceOverlay:
showPerformanceOverlay ?? onShowPerformanceOverlay() ?? false,
checkerboardRasterCacheImages: checkerboardRasterCacheImages ??
onCheckerboardRasterCacheImages() ??
false,
checkerboardOffscreenLayers: checkerboardOffscreenLayers ??
onCheckerboardOffscreenLayers() ??
false,
showSemanticsDebugger:
showSemanticsDebugger ?? onShowSemanticsDebugger() ?? false,
debugShowCheckedModeBanner: debugShowCheckedModeBanner ??
onDebugShowCheckedModeBanner() ??
false,
shortcuts: shortcuts ?? onShortcuts(),
actions: actions ?? onActions(),
customTransition: customTransition,
translationsKeys: translationsKeys,
translations: translations,
textDirection: textDirection,
fallbackLocale: fallbackLocale,
routingCallback: routingCallback,
defaultTransition: defaultTransition,
opaqueRoute: opaqueRoute,
onInit: onInit,
onReady: onReady,
onDispose: onDispose,
enableLog: enableLog ?? kDebugMode,
logWriterCallback: logWriterCallback,
popGesture: popGesture,
smartManagement: smartManagement ?? SmartManagement.full,
initialBinding: initialBinding,
transitionDuration: transitionDuration,
defaultGlobalState: defaultGlobalState,
getPages: getPages,
unknownRoute: unknownRoute,
// restorationScopeId: restorationScopeId ?? onRestorationScopeId(),
scrollBehavior: scrollBehavior ?? onScrollBehavior(),
useInheritedMediaQuery:
useInheritedMediaQuery ?? onInheritedMediaQuery() ?? false,
// Let the parameters run before the home parameter.
home: home ?? onHome(),
);
} else {
//
app = GetMaterialApp.router(
key: key ?? materialKey,
scaffoldMessengerKey:
scaffoldMessengerKey ?? onScaffoldMessengerKey(),
routeInformationProvider:
routeInformationProvider ?? onRouteInformationProvider(),
routeInformationParser: _routeInformationParser,
routerDelegate: _routerDelegate,
// routerConfig: _routerConfig,
backButtonDispatcher:
backButtonDispatcher ?? onBackButtonDispatcher(),
builder: builder ?? onBuilder(),
title: title = onTitle(),
onGenerateTitle: onGenerateTitle ?? onOnGenerateTitle(context),
color: color ?? onColor() ?? Colors.white,
theme: _themeData(),
darkTheme: darkTheme ?? onDarkTheme(),
themeMode: themeMode ?? onThemeMode() ?? ThemeMode.system,
locale: _locale,
localizationsDelegates: onLocalizationsDelegates(),
localeListResolutionCallback:
localeListResolutionCallback ?? onLocaleListResolutionCallback,
localeResolutionCallback:
localeResolutionCallback ?? onLocaleResolutionCallback,
supportedLocales: App.supportedLocales = supportedLocales ??
onSupportedLocales() ??
const <Locale>[Locale('en', 'US')],
debugShowMaterialGrid:
debugShowMaterialGrid ?? onDebugShowMaterialGrid() ?? false,
showPerformanceOverlay:
showPerformanceOverlay ?? onShowPerformanceOverlay() ?? false,
checkerboardRasterCacheImages: checkerboardRasterCacheImages ??
onCheckerboardRasterCacheImages() ??
false,
checkerboardOffscreenLayers: checkerboardOffscreenLayers ??
onCheckerboardOffscreenLayers() ??
false,
showSemanticsDebugger:
showSemanticsDebugger ?? onShowSemanticsDebugger() ?? false,
debugShowCheckedModeBanner: debugShowCheckedModeBanner ??
onDebugShowCheckedModeBanner() ??
false,
shortcuts: shortcuts ?? onShortcuts(),
actions: actions ?? onActions(),
customTransition: customTransition,
translationsKeys: translationsKeys,
translations: translations,
textDirection: textDirection,
fallbackLocale: fallbackLocale,
routingCallback: routingCallback,
defaultTransition: defaultTransition,
opaqueRoute: opaqueRoute,
onInit: onInit,
onReady: onReady,
onDispose: onDispose,
enableLog: enableLog ?? kDebugMode,
logWriterCallback: logWriterCallback,
popGesture: popGesture,
smartManagement: smartManagement ?? SmartManagement.full,
initialBinding: initialBinding,
transitionDuration: transitionDuration,
defaultGlobalState: defaultGlobalState,
getPages: getPages,
unknownRoute: unknownRoute,
// restorationScopeId: restorationScopeId ?? onRestorationScopeId(),
scrollBehavior: scrollBehavior ?? onScrollBehavior(),
useInheritedMediaQuery:
useInheritedMediaQuery ?? onInheritedMediaQuery() ?? false,
);
}
}
// // The theme may not have been set. This property must have a value.
// // Assign Flutter's current theme default
// // App.themeData ??= ThemeData.light();
// if (App.themeData == null) {
// App.themeData = ThemeData.light();
// // If a color is already stored in preferences, don't overwrite.
// App.preferredTheme(
// color: App.themeData!.primaryColor, overWrite: false);
// }
//
// // Supply the iOS theme if necessary.
// App.iOSTheme ??=
// MaterialBasedCupertinoThemeData(materialTheme: App.themeData!);
return app;
}