public override Widget build(BuildContext context) { EdgeInsets padding = MediaQuery.of(context).padding; return(new Padding( padding: EdgeInsets.only( left: Math.Max(this.left ? padding.left : 0.0, this.minimum.left), top: Math.Max(this.top ? padding.top : 0.0, this.minimum.top), right: Math.Max(this.right ? padding.right : 0.0, this.minimum.right), bottom: Math.Max(this.bottom ? padding.bottom : 0.0, this.minimum.bottom) ), child: MediaQuery.removePadding( context: context, removeLeft: this.left, removeTop: this.top, removeRight: this.right, removeBottom: this.bottom, child: this.child))); }
public override Widget build(BuildContext context) { EdgeInsets padding = MediaQuery.of(context).padding; return(new SliverPadding( padding: EdgeInsets.only( left: Mathf.Max(left ? padding.left : 0.0f, minimum.left), top: Mathf.Max(top ? padding.top : 0.0f, minimum.top), right: Mathf.Max(right ? padding.right : 0.0f, minimum.right), bottom: Mathf.Max(bottom ? padding.bottom : 0.0f, minimum.bottom) ), sliver: MediaQuery.removePadding( context: context, removeLeft: left, removeTop: top, removeRight: right, removeBottom: bottom, child: sliver))); }
protected override List <Widget> buildSlivers(BuildContext context) { Widget sliver = buildChildLayout(context); EdgeInsetsGeometry effectivePadding = padding; if (padding == null) { MediaQueryData mediaQuery = MediaQuery.of(context, nullOk: true); if (mediaQuery != null) { EdgeInsets mediaQueryHorizontalPadding = mediaQuery.padding.copyWith(top: 0.0f, bottom: 0.0f); EdgeInsets mediaQueryVerticalPadding = mediaQuery.padding.copyWith(left: 0.0f, right: 0.0f); effectivePadding = scrollDirection == Axis.vertical ? mediaQueryVerticalPadding : mediaQueryHorizontalPadding; sliver = new MediaQuery( data: mediaQuery.copyWith( padding: scrollDirection == Axis.vertical ? mediaQueryHorizontalPadding : mediaQueryVerticalPadding ), child: sliver ); } } if (effectivePadding != null) { sliver = new SliverPadding(padding: effectivePadding, sliver: sliver); } return(new List <Widget> { sliver }); }
public override Widget build(BuildContext context) { FocusScope.of(context).reparentIfNeeded(this.widget.focusNode); base.build(context); // See AutomaticKeepAliveClientMixin. return(new Scrollable( axisDirection: this._isMultiline ? AxisDirection.down : AxisDirection.right, controller: this._scrollController, physics: new ClampingScrollPhysics(), viewportBuilder: (BuildContext _context, ViewportOffset offset) => new CompositedTransformTarget( link: this._layerLink, child: new _Editable( key: this._editableKey, textSpan: this.buildTextSpan(), value: this._value, cursorColor: this.widget.cursorColor, showCursor: this._showCursor, hasFocus: this._hasFocus, maxLines: this.widget.maxLines, selectionColor: this.widget.selectionColor, textScaleFactor: this.widget.textScaleFactor ?? MediaQuery.textScaleFactorOf(context), textAlign: this.widget.textAlign, textDirection: this._textDirection, obscureText: this.widget.obscureText, autocorrect: this.widget.autocorrect, offset: offset, onSelectionChanged: this._handleSelectionChanged, onCaretChanged: this._handleCaretChanged, rendererIgnoresPointer: this.widget.rendererIgnoresPointer, cursorWidth: this.widget.cursorWidth, cursorRadius: this.widget.cursorRadius, enableInteractiveSelection: this.widget.enableInteractiveSelection, textSelectionDelegate: this ) ) )); }
public static MediaQueryData of(BuildContext context, bool nullOk = false) { D.assert(context != null); MediaQuery query = (MediaQuery)context.inheritFromWidgetOfExactType(typeof(MediaQuery)); if (query != null) { return(query.data); } if (nullOk) { return(null); } throw new UIWidgetsError( "MediaQuery.of() called with a context that does not contain a MediaQuery.\n" + "No MediaQuery ancestor could be found starting from the context that was passed " + "to MediaQuery.of(). This can happen because you do not have a WidgetsApp or " + "MaterialApp widget (those widgets introduce a MediaQuery), or it can happen " + "if the context you use comes from a widget above those widgets.\n" + "The context used was:\n" + $" {context}"); }
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); }
void _updateInvertColors() { _invertColors = MediaQuery.of(context: context, true)?.invertColors ?? false; }