onDragSelectionStart method Null safety
- DragStartDetails details
protected">@protected
Handler for TextSelectionGestureDetector.onDragSelectionStart.
By default, it selects a text position specified in details
.
See also:
- TextSelectionGestureDetector.onDragSelectionStart, which triggers this callback.
Implementation
@protected
void onDragSelectionStart(DragStartDetails details) {
if (!delegate.selectionEnabled) {
return;
}
final PointerDeviceKind? kind = details.kind;
_shouldShowSelectionToolbar = kind == null
|| kind == PointerDeviceKind.touch
|| kind == PointerDeviceKind.stylus;
if (_isShiftPressed && renderEditable.selection != null && renderEditable.selection!.isValid) {
_isShiftTapping = true;
switch (defaultTargetPlatform) {
case TargetPlatform.iOS:
case TargetPlatform.macOS:
_expandSelection(details.globalPosition, SelectionChangedCause.drag);
break;
case TargetPlatform.android:
case TargetPlatform.fuchsia:
case TargetPlatform.linux:
case TargetPlatform.windows:
_extendSelection(details.globalPosition, SelectionChangedCause.drag);
break;
}
_shiftTapDragSelection = renderEditable.selection;
} else {
renderEditable.selectPositionAt(
from: details.globalPosition,
cause: SelectionChangedCause.drag,
);
}
_dragStartViewportOffset = renderEditable.offset.pixels;
}