Skip to content
This repository has been archived by the owner on Feb 22, 2023. It is now read-only.

Commit

Permalink
Revert "Add support for double tap and drag for text selection (#1095…
Browse files Browse the repository at this point in the history
…73)" (#117497)

This reverts commit cd0f15a.

Co-authored-by: Renzo Olivares <roliv@google.com>
  • Loading branch information
Renzo-Olivares and Renzo Olivares committed Dec 21, 2022
1 parent 2931e50 commit 39fa011
Show file tree
Hide file tree
Showing 15 changed files with 215 additions and 2,635 deletions.
4 changes: 2 additions & 2 deletions packages/flutter/lib/src/cupertino/text_field.dart
Expand Up @@ -102,7 +102,7 @@ class _CupertinoTextFieldSelectionGestureDetectorBuilder extends TextSelectionGe
final _CupertinoTextFieldState _state;

@override
void onSingleTapUp(TapDragUpDetails details) {
void onSingleTapUp(TapUpDetails details) {
// Because TextSelectionGestureDetector listens to taps that happen on
// widgets in front of it, tapping the clear button will also trigger
// this handler. If the clear button widget recognizes the up event,
Expand All @@ -120,7 +120,7 @@ class _CupertinoTextFieldSelectionGestureDetectorBuilder extends TextSelectionGe
}

@override
void onDragSelectionEnd(TapDragEndDetails details) {
void onDragSelectionEnd(DragEndDetails details) {
_state._requestKeyboard();
}
}
Expand Down
6 changes: 1 addition & 5 deletions packages/flutter/lib/src/gestures/drag_details.dart
Expand Up @@ -109,12 +109,10 @@ class DragStartDetails {
String toString() => '${objectRuntimeType(this, 'DragStartDetails')}($globalPosition)';
}

/// {@template flutter.gestures.dragdetails.GestureDragStartCallback}
/// Signature for when a pointer has contacted the screen and has begun to move.
///
/// The `details` object provides the position of the touch when it first
/// touched the surface.
/// {@endtemplate}
///
/// See [DragGestureRecognizer.onStart].
typedef GestureDragStartCallback = void Function(DragStartDetails details);
Expand All @@ -128,7 +126,7 @@ typedef GestureDragStartCallback = void Function(DragStartDetails details);
/// * [DragStartDetails], the details for [GestureDragStartCallback].
/// * [DragEndDetails], the details for [GestureDragEndCallback].
class DragUpdateDetails {
/// Creates details for a [GestureDragUpdateCallback].
/// Creates details for a [DragUpdateDetails].
///
/// The [delta] argument must not be null.
///
Expand Down Expand Up @@ -197,13 +195,11 @@ class DragUpdateDetails {
String toString() => '${objectRuntimeType(this, 'DragUpdateDetails')}($delta)';
}

/// {@template flutter.gestures.dragdetails.GestureDragUpdateCallback}
/// Signature for when a pointer that is in contact with the screen and moving
/// has moved again.
///
/// The `details` object provides the position of the touch and the distance it
/// has traveled since the last update.
/// {@endtemplate}
///
/// See [DragGestureRecognizer.onUpdate].
typedef GestureDragUpdateCallback = void Function(DragUpdateDetails details);
Expand Down
8 changes: 0 additions & 8 deletions packages/flutter/lib/src/gestures/monodrag.dart
Expand Up @@ -26,13 +26,11 @@ enum _DragState {
accepted,
}

/// {@template flutter.gestures.monodrag.GestureDragEndCallback}
/// Signature for when a pointer that was previously in contact with the screen
/// and moving is no longer in contact with the screen.
///
/// The velocity at which the pointer was moving when it stopped contacting
/// the screen is available in the `details`.
/// {@endtemplate}
///
/// Used by [DragGestureRecognizer.onEnd].
typedef GestureDragEndCallback = void Function(DragEndDetails details);
Expand Down Expand Up @@ -126,10 +124,8 @@ abstract class DragGestureRecognizer extends OneSequenceGestureRecognizer {
/// * [DragDownDetails], which is passed as an argument to this callback.
GestureDragDownCallback? onDown;

/// {@template flutter.gestures.monodrag.DragGestureRecognizer.onStart}
/// A pointer has contacted the screen with a primary button and has begun to
/// move.
/// {@endtemplate}
///
/// The position of the pointer is provided in the callback's `details`
/// argument, which is a [DragStartDetails] object. The [dragStartBehavior]
Expand All @@ -141,10 +137,8 @@ abstract class DragGestureRecognizer extends OneSequenceGestureRecognizer {
/// * [DragStartDetails], which is passed as an argument to this callback.
GestureDragStartCallback? onStart;

/// {@template flutter.gestures.monodrag.DragGestureRecognizer.onUpdate}
/// A pointer that is in contact with the screen with a primary button and
/// moving has moved again.
/// {@endtemplate}
///
/// The distance traveled by the pointer since the last update is provided in
/// the callback's `details` argument, which is a [DragUpdateDetails] object.
Expand All @@ -155,11 +149,9 @@ abstract class DragGestureRecognizer extends OneSequenceGestureRecognizer {
/// * [DragUpdateDetails], which is passed as an argument to this callback.
GestureDragUpdateCallback? onUpdate;

/// {@template flutter.gestures.monodrag.DragGestureRecognizer.onEnd}
/// A pointer that was previously in contact with the screen with a primary
/// button and moving is no longer in contact with the screen and was moving
/// at a specific velocity when it stopped contacting the screen.
/// {@endtemplate}
///
/// The velocity is provided in the callback's `details` argument, which is a
/// [DragEndDetails] object.
Expand Down
18 changes: 0 additions & 18 deletions packages/flutter/lib/src/gestures/tap.dart
Expand Up @@ -45,13 +45,11 @@ class TapDownDetails {
final Offset localPosition;
}

/// {@template flutter.gestures.tap.GestureTapDownCallback}
/// Signature for when a pointer that might cause a tap has contacted the
/// screen.
///
/// The position at which the pointer contacted the screen is available in the
/// `details`.
/// {@endtemplate}
///
/// See also:
///
Expand Down Expand Up @@ -84,13 +82,11 @@ class TapUpDetails {
final PointerDeviceKind kind;
}

/// {@template flutter.gestures.tap.GestureTapUpCallback}
/// Signature for when a pointer that will trigger a tap has stopped contacting
/// the screen.
///
/// The position at which the pointer stopped contacting the screen is available
/// in the `details`.
/// {@endtemplate}
///
/// See also:
///
Expand Down Expand Up @@ -364,10 +360,8 @@ class TapGestureRecognizer extends BaseTapGestureRecognizer {
/// {@macro flutter.gestures.GestureRecognizer.supportedDevices}
TapGestureRecognizer({ super.debugOwner, super.supportedDevices });

/// {@template flutter.gestures.tap.TapGestureRecognizer.onTapDown}
/// A pointer has contacted the screen at a particular location with a primary
/// button, which might be the start of a tap.
/// {@endtemplate}
///
/// This triggers after the down event, once a short timeout ([deadline]) has
/// elapsed, or once the gestures has won the arena, whichever comes first.
Expand All @@ -384,10 +378,8 @@ class TapGestureRecognizer extends BaseTapGestureRecognizer {
/// * [GestureDetector.onTapDown], which exposes this callback.
GestureTapDownCallback? onTapDown;

/// {@template flutter.gestures.tap.TapGestureRecognizer.onTapUp}
/// A pointer has stopped contacting the screen at a particular location,
/// which is recognized as a tap of a primary button.
/// {@endtemplate}
///
/// This triggers on the up event, if the recognizer wins the arena with it
/// or has previously won, immediately followed by [onTap].
Expand Down Expand Up @@ -419,10 +411,8 @@ class TapGestureRecognizer extends BaseTapGestureRecognizer {
/// * [GestureDetector.onTap], which exposes this callback.
GestureTapCallback? onTap;

/// {@template flutter.gestures.tap.TapGestureRecognizer.onTapCancel}
/// A pointer that previously triggered [onTapDown] will not end up causing
/// a tap.
/// {@endtemplate}
///
/// This triggers once the gesture loses the arena if [onTapDown] has
/// previously been triggered.
Expand All @@ -438,10 +428,8 @@ class TapGestureRecognizer extends BaseTapGestureRecognizer {
/// * [GestureDetector.onTapCancel], which exposes this callback.
GestureTapCancelCallback? onTapCancel;

/// {@template flutter.gestures.tap.TapGestureRecognizer.onSecondaryTap}
/// A pointer has stopped contacting the screen, which is recognized as a tap
/// of a secondary button.
/// {@endtemplate}
///
/// This triggers on the up event, if the recognizer wins the arena with it or
/// has previously won, immediately following [onSecondaryTapUp].
Expand All @@ -456,10 +444,8 @@ class TapGestureRecognizer extends BaseTapGestureRecognizer {
/// * [GestureDetector.onSecondaryTap], which exposes this callback.
GestureTapCallback? onSecondaryTap;

/// {@template flutter.gestures.tap.TapGestureRecognizer.onSecondaryTapDown}
/// A pointer has contacted the screen at a particular location with a
/// secondary button, which might be the start of a secondary tap.
/// {@endtemplate}
///
/// This triggers after the down event, once a short timeout ([deadline]) has
/// elapsed, or once the gestures has won the arena, whichever comes first.
Expand All @@ -476,10 +462,8 @@ class TapGestureRecognizer extends BaseTapGestureRecognizer {
/// * [GestureDetector.onSecondaryTapDown], which exposes this callback.
GestureTapDownCallback? onSecondaryTapDown;

/// {@template flutter.gestures.tap.TapGestureRecognizer.onSecondaryTapUp}
/// A pointer has stopped contacting the screen at a particular location,
/// which is recognized as a tap of a secondary button.
/// {@endtemplate}
///
/// This triggers on the up event if the recognizer wins the arena with it
/// or has previously won.
Expand All @@ -498,10 +482,8 @@ class TapGestureRecognizer extends BaseTapGestureRecognizer {
/// * [GestureDetector.onSecondaryTapUp], which exposes this callback.
GestureTapUpCallback? onSecondaryTapUp;

/// {@template flutter.gestures.tap.TapGestureRecognizer.onSecondaryTapCancel}
/// A pointer that previously triggered [onSecondaryTapDown] will not end up
/// causing a tap.
/// {@endtemplate}
///
/// This triggers once the gesture loses the arena if [onSecondaryTapDown]
/// has previously been triggered.
Expand Down
2 changes: 1 addition & 1 deletion packages/flutter/lib/src/material/selectable_text.dart
Expand Up @@ -85,7 +85,7 @@ class _SelectableTextSelectionGestureDetectorBuilder extends TextSelectionGestur
}

@override
void onSingleTapUp(TapDragUpDetails details) {
void onSingleTapUp(TapUpDetails details) {
editableText.hideToolbar();
if (delegate.selectionEnabled) {
switch (Theme.of(_state.context).platform) {
Expand Down
2 changes: 1 addition & 1 deletion packages/flutter/lib/src/material/text_field.dart
Expand Up @@ -65,7 +65,7 @@ class _TextFieldSelectionGestureDetectorBuilder extends TextSelectionGestureDete
}

@override
void onSingleTapUp(TapDragUpDetails details) {
void onSingleTapUp(TapUpDetails details) {
super.onSingleTapUp(details);
_state._requestKeyboard();
_state.widget.onTap?.call();
Expand Down

0 comments on commit 39fa011

Please sign in to comment.