onSingleTapUp method

  1. @protected
void onSingleTapUp(
  1. TapUpDetails details
)

Handler for TextSelectionGestureDetector.onSingleTapUp.

By default, it selects word edge if selection is enabled.

See also:

Implementation

@protected
void onSingleTapUp(TapUpDetails details) {
  if (_isShiftTapping) {
    _isShiftTapping = false;
    return;
  }

  if (delegate.selectionEnabled) {
    switch (defaultTargetPlatform) {
      case TargetPlatform.iOS:
      case TargetPlatform.macOS:
        switch (details.kind) {
          case PointerDeviceKind.mouse:
          case PointerDeviceKind.stylus:
          case PointerDeviceKind.invertedStylus:
            // Precise devices should place the cursor at a precise position.
            renderEditable.selectPosition(cause: SelectionChangedCause.tap);
            break;
          case PointerDeviceKind.touch:
          case PointerDeviceKind.unknown:
            // On macOS/iOS/iPadOS a touch tap places the cursor at the edge
            // of the word.
            renderEditable.selectWordEdge(cause: SelectionChangedCause.tap);
            break;
        }
        break;
      case TargetPlatform.android:
      case TargetPlatform.fuchsia:
      case TargetPlatform.linux:
      case TargetPlatform.windows:
        renderEditable.selectPosition(cause: SelectionChangedCause.tap);
        break;
    }
  }
}