void _handleSelectionChanged(TextSelection selection, SelectionChangedCause cause) { bool willShowSelectionHandles = _shouldShowSelectionHandles(cause); if (willShowSelectionHandles != _showSelectionHandles) { setState(() => { _showSelectionHandles = willShowSelectionHandles; }); } switch (Theme.of(context).platform) { case RuntimePlatform.IPhonePlayer: case RuntimePlatform.OSXEditor: case RuntimePlatform.OSXPlayer: if (cause == SelectionChangedCause.longPress) { _editableText?.bringIntoView(selection.basePos); } return; default: // Do nothing. break; } }
bool _shouldShowSelectionHandles(SelectionChangedCause cause) { if (!_selectionGestureDetectorBuilder.shouldShowSelectionToolbar) { return(false); } if (_controller.selection.isCollapsed) { return(false); } if (cause == SelectionChangedCause.keyboard) { return(false); } if (cause == SelectionChangedCause.longPress) { return(true); } if (_controller.text.isNotEmpty()) { return(true); } return(false); }
void _handleSelectionChanged(TextSelection selection, SelectionChangedCause cause) { if (cause == SelectionChangedCause.longPress) { this._editableText?.bringIntoView(selection.basePos); } }
void _handleSelectionChanged(TextSelection selection, SelectionChangedCause cause) { if (cause == SelectionChangedCause.longPress) { // Feedback.forLongPress(context); todo add feedback } }
void selectWordEdge(SelectionChangedCause cause) { this._layoutText(this.constraints.maxWidth); D.assert(this._lastTapDownPosition != null); if (this.onSelectionChanged != null) { TextPosition position = this._textPainter.getPositionForOffset(this.globalToLocal(this._lastTapDownPosition)); TextRange word = this._textPainter.getWordBoundary(position); if (position.offset - word.start <= 1) { this.onSelectionChanged( TextSelection.collapsed(offset: word.start, affinity: TextAffinity.downstream), this, cause ); } else { this.onSelectionChanged( TextSelection.collapsed(offset: word.end, affinity: TextAffinity.upstream), this, cause ); } } }
bool _shouldShowSelectionHandles(SelectionChangedCause cause) { // When the text field is activated by something that doesn't trigger the // selection overlay, we shouldn't show the handles either. if (!_selectionGestureDetectorBuilder.shouldShowSelectionToolbar) { return(false); } // On iOS, we don't show handles when the selection is collapsed. if (_effectiveController.selection.isCollapsed) { return(false); } if (cause == SelectionChangedCause.keyboard) { return(false); } if (_effectiveController.text.isNotEmpty()) { return(true); } return(false); }
void _handleSelectionChanged(TextSelection selection, SelectionChangedCause cause) { if (Theme.of(this.context).platform == RuntimePlatform.IPhonePlayer && cause == SelectionChangedCause.longPress) { this._editableTextKey.currentState?.bringIntoView(selection.basePos); } }
void _handleSelectionChanged(TextSelection selection, SelectionChangedCause cause) { bool willShowSelectionHandles = _shouldShowSelectionHandles(cause); if (willShowSelectionHandles != _showSelectionHandles) { setState(() => { _showSelectionHandles = willShowSelectionHandles; }); } //use the code path for android by default return; }
void _handleSelectionChanged(TextSelection selection, SelectionChangedCause cause) { if (cause == SelectionChangedCause.longPress) { _editableText?.bringIntoView(selection._base); } bool willShowSelectionHandles = _shouldShowSelectionHandles(cause); if (willShowSelectionHandles != _showSelectionHandles) { setState(() => { _showSelectionHandles = willShowSelectionHandles; }); } }
void _handleSelectionChanged(TextSelection selection, SelectionChangedCause cause) { switch (Theme.of(this.context).platform) { case RuntimePlatform.IPhonePlayer: if (cause == SelectionChangedCause.longPress) { this._editableTextKey.currentState?.bringIntoView(selection.basePos); } return; case RuntimePlatform.Android: break; } }
void _handleSelectionChanged(TextSelection selection, RenderEditable renderObject, SelectionChangedCause cause) { this.widget.controller.selection = selection; this.requestKeyboard(); this._hideSelectionOverlayIfNeeded(); if (this.widget.selectionControls != null) { this._selectionOverlay = new TextSelectionOverlay( context: this.context, value: this._value, debugRequiredFor: this.widget, layerLink: this._layerLink, renderObject: renderObject, selectionControls: this.widget.selectionControls, selectionDelegate: this ); bool longPress = cause == SelectionChangedCause.longPress; if (cause != SelectionChangedCause.keyboard && (this._value.text.isNotEmpty() || longPress)) { this._selectionOverlay.showHandles(); } if (longPress || cause == SelectionChangedCause.doubleTap) { this._selectionOverlay.showToolbar(); } } if (this.widget.onSelectionChanged != null) { this.widget.onSelectionChanged(selection, cause); } }
void _handleSelectionChanged(TextSelection selection, SelectionChangedCause cause) { this.selection = selection; this.onSelectionChanged?.Invoke(); }
void selectionChanged(TextSelection selection, Unity.UIWidgets.rendering.RenderEditable renderObject, SelectionChangedCause cause) { Debug.Log($"selection {selection}"); renderObject.selection = selection; }