Ejemplo n.º 1
0
        public override Widget build(BuildContext context)
        {
            Widget navigator = null;

            if (this._navigator != null)
            {
                navigator = new Navigator(
                    key: this._navigator,
                    initialRoute: this.widget.initialRoute ?? Navigator.defaultRouteName,
                    onGenerateRoute: this._onGenerateRoute,
                    onUnknownRoute: this._onUnknownRoute,
                    observers: this.widget.navigatorObservers
                    );
            }


            Widget result;

            if (this.widget.builder != null)
            {
                result = new Builder(
                    builder: _context => { return(this.widget.builder(_context, navigator)); }
                    );
            }
            else
            {
                D.assert(navigator != null);
                result = navigator;
            }

            if (this.widget.textStyle != null)
            {
                result = new DefaultTextStyle(
                    style: this.widget.textStyle,
                    child: result
                    );
            }

            PerformanceOverlay performanceOverlay = null;

            if (this.widget.showPerformanceOverlay)
            {
                performanceOverlay = PerformanceOverlay.allEnabled();
            }

            if (performanceOverlay != null)
            {
                result = new Stack(
                    children: new List <Widget> {
                    result,
                    new Positioned(top: 0.0f,
                                   left: 0.0f,
                                   right: 0.0f,
                                   child: performanceOverlay)
                });
            }

            D.assert(() => {
                if (WidgetInspectorService.instance.debugShowInspector)
                {
                    result = new WidgetInspector(null, result, this._InspectorSelectButtonBuilder);
                }

                return(true);
            });

            result = new Directionality(child: result, TextDirection.ltr);
            result = new WindowProvider(
                window: this.widget.window,
                child: result
                );

            Locale appLocale = this.widget.locale != null
                ? this._resolveLocales(new List <Locale> {
                this.widget.locale
            }, this.widget.supportedLocales)
                : this._locale;

            result = new MediaQuery(
                data: MediaQueryData.fromWindow(this.widget.window),
                child: new Localizations(
                    locale: appLocale,
                    delegates: this._localizationsDelegates,
                    child: result)
                );

            return(result);
        }