Ejemplo n.º 1
0
        public override Widget build(BuildContext context)
        {
            Widget result = new WidgetsApp(
                key: new GlobalObjectKey <State>(this),
                navigatorKey: this.widget.navigatorKey,
                navigatorObservers: this._navigatorObservers,
                pageRouteBuilder: (RouteSettings settings, WidgetBuilder builder) =>
                new MaterialPageRoute(settings: settings, builder: builder),
                home: this.widget.home,
                routes: this.widget.routes,
                initialRoute: this.widget.initialRoute,
                onGenerateRoute: this.widget.onGenerateRoute,
                onUnknownRoute: this.widget.onUnknownRoute,
                builder: (BuildContext _context, Widget child) => {
                ThemeData theme;
                Brightness platformBrightness = MediaQuery.platformBrightnessOf(_context);
                if (platformBrightness == Brightness.dark && this.widget.darkTheme != null)
                {
                    theme = this.widget.darkTheme;
                }
                else if (this.widget.theme != null)
                {
                    theme = this.widget.theme;
                }
                else
                {
                    theme = ThemeData.fallback();
                }

                return(new AnimatedTheme(
                           data: theme,
                           isMaterialAppTheme: true,
                           child: this.widget.builder != null
                            ? new Builder(
                               builder: (__context) => { return this.widget.builder(__context, child); }
                               )
                            : child
                           ));
            },
                textStyle: AppUtils._errorTextStyle,
                locale: this.widget.locale,
                localizationsDelegates: this._localizationsDelegates,
                localeResolutionCallback: this.widget.localeResolutionCallback,
                localeListResolutionCallback: this.widget.localeListResolutionCallback,
                supportedLocales: this.widget.supportedLocales,
                showPerformanceOverlay: this.widget.showPerformanceOverlay
                );

            return(result);
        }
Ejemplo n.º 2
0
        public override Widget build(BuildContext context)
        {
            Widget result = new WidgetsApp(
                key: new GlobalObjectKey <State>(this),
                navigatorKey: widget.navigatorKey,
                navigatorObservers: _navigatorObservers,
                pageRouteBuilder: (RouteSettings settings, WidgetBuilder builder) =>
                new MaterialPageRoute(settings: settings, builder: builder),
                home: widget.home,
                routes: widget.routes,
                initialRoute: widget.initialRoute,
                onGenerateRoute: widget.onGenerateRoute,
                onGenerateInitialRoutes: widget.onGenerateInitialRoutes,
                onUnknownRoute: widget.onUnknownRoute,
                builder: (BuildContext _context, Widget child) => {
                ThemeMode mode  = widget.themeMode;
                ThemeData theme = null;
                if (widget.darkTheme != null)
                {
                    ui.Brightness platformBrightness = MediaQuery.platformBrightnessOf(context);
                    if (mode == ThemeMode.dark ||
                        (mode == ThemeMode.system && platformBrightness == ui.Brightness.dark))
                    {
                        theme = widget.darkTheme;
                    }
                }

                theme = theme ?? widget.theme ?? ThemeData.fallback();

                return(new AnimatedTheme(
                           data: theme,
                           isMaterialAppTheme: true,
                           child: widget.builder != null
                            ? new Builder(
                               builder: (__context) => { return widget.builder(__context, child); }
                               )
                            : child
                           ));
            },
                textStyle: material_._errorTextStyle,
                title: widget.title,
                onGenerateTitle: widget.onGenerateTitle,
                color: widget.color ?? widget.theme?.primaryColor ?? Colors.blue,
                locale: widget.locale,
                localizationsDelegates: _localizationsDelegates,
                localeResolutionCallback: widget.localeResolutionCallback,
                localeListResolutionCallback: widget.localeListResolutionCallback,
                supportedLocales: widget.supportedLocales,
                showPerformanceOverlay: widget.showPerformanceOverlay,
                checkerboardRasterCacheImages: widget.checkerboardRasterCacheImages,
                checkerboardOffscreenLayers: widget.checkerboardOffscreenLayers,
                debugShowCheckedModeBanner: widget.debugShowCheckedModeBanner,
                inspectorSelectButtonBuilder: (BuildContext contextIn, VoidCallback onPressed) => {
                return(new FloatingActionButton(
                           child: new Icon(Icons.search),
                           onPressed: onPressed,
                           mini: true
                           ));
            },
                shortcuts: widget.shortcuts,
                actions: widget.actions
                );

            return(result);
        }