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); }
public override Widget build(BuildContext context) { Widget navigator = null; if (_navigator != null) { RouteListFactory routeListFactory = (state, route) => { return(widget.onGenerateInitialRoutes(initialRoute: route)); }; navigator = new Navigator( key: _navigator, initialRoute: WidgetsBinding.instance.window.defaultRouteName != Navigator.defaultRouteName ? WidgetsBinding.instance.window.defaultRouteName : widget.initialRoute ?? WidgetsBinding.instance.window.defaultRouteName, onGenerateRoute: _onGenerateRoute, onGenerateInitialRoutes: widget.onGenerateInitialRoutes == null ? Navigator.defaultGenerateInitialRoutes : routeListFactory, onUnknownRoute: _onUnknownRoute, observers: widget.navigatorObservers ); } Widget result; if (widget.builder != null) { result = new Builder( builder: context1 => { return(widget.builder(context: context1, child: navigator)); }); } else { D.assert(navigator != null); result = navigator; } if (widget.textStyle != null) { result = new DefaultTextStyle( style: widget.textStyle, child: result ); } PerformanceOverlay performanceOverlay = null; if (widget.showPerformanceOverlay || WidgetsApp.showPerformanceOverlayOverride) { performanceOverlay = PerformanceOverlay.allEnabled( checkerboardRasterCacheImages: widget.checkerboardRasterCacheImages, checkerboardOffscreenLayers: widget.checkerboardOffscreenLayers ); } else if (widget.checkerboardRasterCacheImages || widget.checkerboardOffscreenLayers) { performanceOverlay = new PerformanceOverlay( checkerboardRasterCacheImages: widget.checkerboardRasterCacheImages, checkerboardOffscreenLayers: widget.checkerboardOffscreenLayers ); } 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 (widget.debugShowWidgetInspector || WidgetsApp.debugShowWidgetInspectorOverride) { result = new WidgetInspector( child: result, selectButtonBuilder: widget.inspectorSelectButtonBuilder ); } if (widget.debugShowCheckedModeBanner && WidgetsApp.debugAllowBannerOverride) { result = new CheckedModeBanner( child: result ); } return(true); }); //Fix Me !! //TODO: the following line is a work-around for some potential TextDirection bug //In the home page of the Shrine sample, the positions of the buttons are not correct, which is //determined by the TextDirection of some widget. we should fix it! result = new Directionality(child: result, TextDirection.ltr); Widget title = null; if (widget.onGenerateTitle != null) { title = new Builder( builder: context2 => { var _title = widget.onGenerateTitle(context: context2); D.assert(_title != null, () => "onGenerateTitle must return a non-null String"); return(new Title( title: _title, color: widget.color, child: result )); } ); } else { title = new Title( title: widget.title, color: widget.color, child: result ); } var appLocale = widget.locale != null ? _resolveLocales(new List <Locale> { widget.locale }, supportedLocales : widget.supportedLocales) : _locale; D.assert(_debugCheckLocalizations(appLocale: appLocale)); return(new Shortcuts( shortcuts: widget.shortcuts ?? WidgetsApp.defaultShortcuts, debugLabel: "<Default WidgetsApp Shortcuts>", child: new Actions( actions: widget.actions ?? WidgetsApp.defaultActions, child: new FocusTraversalGroup( policy: new ReadingOrderTraversalPolicy(), child: new _MediaQueryFromWindow( child: new Localizations( locale: appLocale, delegates: _localizationsDelegates.ToList(), child: title ) ) ) ) )); }