Skip to content

Commit 39fa011

Browse files
Renzo-OlivaresRenzo Olivares
and
Renzo Olivares
authored
Revert "Add support for double tap and drag for text selection (flutter#109573)" (flutter#117497)
This reverts commit cd0f15a. Co-authored-by: Renzo Olivares <[email protected]>
1 parent 2931e50 commit 39fa011

15 files changed

+215
-2635
lines changed

Diff for: packages/flutter/lib/src/cupertino/text_field.dart

+2-2
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ class _CupertinoTextFieldSelectionGestureDetectorBuilder extends TextSelectionGe
102102
final _CupertinoTextFieldState _state;
103103

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

122122
@override
123-
void onDragSelectionEnd(TapDragEndDetails details) {
123+
void onDragSelectionEnd(DragEndDetails details) {
124124
_state._requestKeyboard();
125125
}
126126
}

Diff for: packages/flutter/lib/src/gestures/drag_details.dart

+1-5
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,10 @@ class DragStartDetails {
109109
String toString() => '${objectRuntimeType(this, 'DragStartDetails')}($globalPosition)';
110110
}
111111

112-
/// {@template flutter.gestures.dragdetails.GestureDragStartCallback}
113112
/// Signature for when a pointer has contacted the screen and has begun to move.
114113
///
115114
/// The `details` object provides the position of the touch when it first
116115
/// touched the surface.
117-
/// {@endtemplate}
118116
///
119117
/// See [DragGestureRecognizer.onStart].
120118
typedef GestureDragStartCallback = void Function(DragStartDetails details);
@@ -128,7 +126,7 @@ typedef GestureDragStartCallback = void Function(DragStartDetails details);
128126
/// * [DragStartDetails], the details for [GestureDragStartCallback].
129127
/// * [DragEndDetails], the details for [GestureDragEndCallback].
130128
class DragUpdateDetails {
131-
/// Creates details for a [GestureDragUpdateCallback].
129+
/// Creates details for a [DragUpdateDetails].
132130
///
133131
/// The [delta] argument must not be null.
134132
///
@@ -197,13 +195,11 @@ class DragUpdateDetails {
197195
String toString() => '${objectRuntimeType(this, 'DragUpdateDetails')}($delta)';
198196
}
199197

200-
/// {@template flutter.gestures.dragdetails.GestureDragUpdateCallback}
201198
/// Signature for when a pointer that is in contact with the screen and moving
202199
/// has moved again.
203200
///
204201
/// The `details` object provides the position of the touch and the distance it
205202
/// has traveled since the last update.
206-
/// {@endtemplate}
207203
///
208204
/// See [DragGestureRecognizer.onUpdate].
209205
typedef GestureDragUpdateCallback = void Function(DragUpdateDetails details);

Diff for: packages/flutter/lib/src/gestures/monodrag.dart

-8
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,11 @@ enum _DragState {
2626
accepted,
2727
}
2828

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

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

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

158-
/// {@template flutter.gestures.monodrag.DragGestureRecognizer.onEnd}
159152
/// A pointer that was previously in contact with the screen with a primary
160153
/// button and moving is no longer in contact with the screen and was moving
161154
/// at a specific velocity when it stopped contacting the screen.
162-
/// {@endtemplate}
163155
///
164156
/// The velocity is provided in the callback's `details` argument, which is a
165157
/// [DragEndDetails] object.

Diff for: packages/flutter/lib/src/gestures/tap.dart

-18
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,11 @@ class TapDownDetails {
4545
final Offset localPosition;
4646
}
4747

48-
/// {@template flutter.gestures.tap.GestureTapDownCallback}
4948
/// Signature for when a pointer that might cause a tap has contacted the
5049
/// screen.
5150
///
5251
/// The position at which the pointer contacted the screen is available in the
5352
/// `details`.
54-
/// {@endtemplate}
5553
///
5654
/// See also:
5755
///
@@ -84,13 +82,11 @@ class TapUpDetails {
8482
final PointerDeviceKind kind;
8583
}
8684

87-
/// {@template flutter.gestures.tap.GestureTapUpCallback}
8885
/// Signature for when a pointer that will trigger a tap has stopped contacting
8986
/// the screen.
9087
///
9188
/// The position at which the pointer stopped contacting the screen is available
9289
/// in the `details`.
93-
/// {@endtemplate}
9490
///
9591
/// See also:
9692
///
@@ -364,10 +360,8 @@ class TapGestureRecognizer extends BaseTapGestureRecognizer {
364360
/// {@macro flutter.gestures.GestureRecognizer.supportedDevices}
365361
TapGestureRecognizer({ super.debugOwner, super.supportedDevices });
366362

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

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

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

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

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

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

501-
/// {@template flutter.gestures.tap.TapGestureRecognizer.onSecondaryTapCancel}
502485
/// A pointer that previously triggered [onSecondaryTapDown] will not end up
503486
/// causing a tap.
504-
/// {@endtemplate}
505487
///
506488
/// This triggers once the gesture loses the arena if [onSecondaryTapDown]
507489
/// has previously been triggered.

Diff for: packages/flutter/lib/src/material/selectable_text.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ class _SelectableTextSelectionGestureDetectorBuilder extends TextSelectionGestur
8585
}
8686

8787
@override
88-
void onSingleTapUp(TapDragUpDetails details) {
88+
void onSingleTapUp(TapUpDetails details) {
8989
editableText.hideToolbar();
9090
if (delegate.selectionEnabled) {
9191
switch (Theme.of(_state.context).platform) {

Diff for: packages/flutter/lib/src/material/text_field.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ class _TextFieldSelectionGestureDetectorBuilder extends TextSelectionGestureDete
6565
}
6666

6767
@override
68-
void onSingleTapUp(TapDragUpDetails details) {
68+
void onSingleTapUp(TapUpDetails details) {
6969
super.onSingleTapUp(details);
7070
_state._requestKeyboard();
7171
_state.widget.onTap?.call();

0 commit comments

Comments
 (0)