onDragSelectionUpdate method
Handler for TextSelectionGestureDetector.onDragSelectionUpdate.
By default, it updates the selection location specified in the provided details objects.
See also:
- TextSelectionGestureDetector.onDragSelectionUpdate, which triggers this callback./lib/src/material/text_field.dart
Implementation
@protected
void onDragSelectionUpdate(
DragStartDetails startDetails, DragUpdateDetails updateDetails) {
if (!delegate.selectionEnabled) return;
// Adjust the drag start offset for possible viewport offset changes.
final Offset startOffset = renderEditable.maxLines == 1
? Offset(renderEditable.offset.pixels - _dragStartViewportOffset, 0.0)
: Offset(0.0, renderEditable.offset.pixels - _dragStartViewportOffset);
renderEditable.selectPositionAt(
from: startDetails.globalPosition - startOffset,
to: updateDetails.globalPosition,
cause: SelectionChangedCause.drag,
);
}