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 ) ) )); }
void _handleAutofocus() { if (!_didAutofocus && widget.autofocus) { FocusScope.of(context).autofocus(focusNode); _didAutofocus = true; } }
public override void didChangeDependencies() { base.didChangeDependencies(); if (!this._didAutoFocus && this.widget.autofocus) { FocusScope.of(this.context).autofocus(this.widget.focusNode); this._didAutoFocus = true; } }
public void requestKeyboard() { if (this._hasFocus) { this._openInputConnection(); } else { FocusScope.of(this.context).requestFocus(this.widget.focusNode); } }
public override Widget build(BuildContext context) { FocusScope.of(context).reparentIfNeeded(this.widget.focusNode); DefaultTextStyle defaultTextStyle = DefaultTextStyle.of(context); TextStyle effectiveTextStyle = this.widget.style; if (this.widget.style == null || this.widget.style.inherit) { effectiveTextStyle = defaultTextStyle.style.merge(this.widget.style); } Widget child = new RichText( key: this._richTextKey, textAlign: this.widget.textAlign ?? defaultTextStyle.textAlign ?? TextAlign.left, softWrap: this.widget.softWrap ?? defaultTextStyle.softWrap, overflow: this.widget.overflow ?? defaultTextStyle.overflow, textScaleFactor: this.widget.textScaleFactor ?? MediaQuery.textScaleFactorOf(context), maxLines: this.widget.maxLines ?? defaultTextStyle.maxLines, text: new TextSpan( style: effectiveTextStyle, text: this.widget.data, children: this.widget.textSpan != null ? new List <TextSpan> { this.widget.textSpan } : null ), onSelectionChanged: () => { if (this._hasFocus) { return; } FocusScope.of(this.context).requestFocus(this.widget.focusNode); }, selectionColor: this.widget.selectionColor ?? Colors.blue); return(new IgnorePointer( ignoring: false, child: new RichTextSelectionGestureDetector( onTapDown: this._handleTapDown, onSingleTapUp: this._handleSingleTapUp, onSingleTapCancel: this._handleSingleTapCancel, onSingleLongTapStart: this._handleLongPress, onDragSelectionStart: this._handleDragSelectionStart, onDragSelectionUpdate: this._handleDragSelectionUpdate, behavior: HitTestBehavior.translucent, child: child ) )); }
public override Widget build(BuildContext context) { List <Widget> slivers = buildSlivers(context); AxisDirection axisDirection = getDirection(context); ScrollController scrollController = primary ? PrimaryScrollController.of(context) : controller; Scrollable scrollable = new Scrollable( dragStartBehavior: dragStartBehavior, axisDirection: axisDirection, controller: scrollController, physics: physics, viewportBuilder: (viewportContext, offset) => buildViewport(viewportContext, offset, axisDirection, slivers) ); Widget scrollableResult = primary && scrollController != null ? (Widget)PrimaryScrollController.none(child: scrollable) : scrollable; if (keyboardDismissBehavior == ScrollViewKeyboardDismissBehavior.onDrag) { return(new NotificationListener <ScrollUpdateNotification>( child: scrollableResult, onNotification: (ScrollUpdateNotification notification) => { FocusScopeNode focusScope = FocusScope.of(context); if (notification.dragDetails != null && focusScope.hasFocus) { focusScope.unfocus(); } return false; } )); } else { return(scrollableResult); } }