onSingleTapUp method

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

Handler for TextSelectionGestureDetector.onSingleTapUp.

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

See also:

Implementation

@override
void onSingleTapUp(TapUpDetails details) {
  hideToolbar();
  if (delegate.selectionEnabled) {
    switch (Theme.of(_context).platform) {
      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;
    }
  }
  _requestKeyboard?.call();
  _onTap?.call();
}