buildApp method

  1. @override
Widget buildApp(
  1. BuildContext context
)
override

Override to impose your own WidgetsApp (like CupertinoApp or MaterialApp)

Implementation

@override
Widget buildApp(BuildContext context) {
  //
  if (useCupertino!) {
    return CupertinoApp(
      key: key ?? v.App.widgetsAppKey,
      navigatorKey: navigatorKey ?? onNavigatorKey(),
      home: home ?? onHome(),
      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: iOSTheme ?? oniOSTheme() ?? v.App.iOSTheme,
      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(),
    );
  } else {
    _routerDelegate = routerDelegate ?? onRouterDelegate();
    _routeInformationParser =
        routeInformationParser ?? onRouteInformationParser();
    if (_routerDelegate == null || _routeInformationParser == null) {
      return MaterialApp(
        key: key ?? v.App.widgetsAppKey,
        navigatorKey: navigatorKey ?? onNavigatorKey(),
        scaffoldMessengerKey:
            scaffoldMessengerKey ?? onScaffoldMessengerKey(),
        home: home ?? onHome(),
        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: theme ?? onTheme() ?? v.App.themeData,
        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(),
      );
    } else {
      return MaterialApp.router(
        key: key ?? v.App.widgetsAppKey,
        routeInformationProvider:
            routeInformationProvider ?? onRouteInformationProvider(),
        routeInformationParser: _routeInformationParser!,
        routerDelegate: _routerDelegate!,
        backButtonDispatcher:
            backButtonDispatcher ?? onBackButtonDispatcher(),
        scaffoldMessengerKey:
            scaffoldMessengerKey ?? onScaffoldMessengerKey(),
        builder: builder ?? onBuilder(),
        title: title = onTitle(),
        onGenerateTitle: onGenerateTitle ?? onOnGenerateTitle(context),
        color: color ?? onColor() ?? Colors.white,
        theme: theme ?? onTheme() ?? v.App.themeData,
        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(),
      );
    }
  }
}