Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
4fd27eb6
Unverified
Commit
4fd27eb6
authored
Jul 22, 2022
by
Pedro Massango
Committed by
GitHub
Jul 22, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix GestureDetector.onDoubleTapDown not getting called (#108056)
parent
6898e096
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
51 additions
and
1 deletion
+51
-1
gesture_detector.dart
packages/flutter/lib/src/widgets/gesture_detector.dart
+3
-1
gesture_detector_test.dart
packages/flutter/test/widgets/gesture_detector_test.dart
+48
-0
No files found.
packages/flutter/lib/src/widgets/gesture_detector.dart
View file @
4fd27eb6
...
...
@@ -1047,7 +1047,9 @@ class GestureDetector extends StatelessWidget {
);
}
if
(
onDoubleTap
!=
null
)
{
if
(
onDoubleTap
!=
null
||
onDoubleTapDown
!=
null
||
onDoubleTapCancel
!=
null
)
{
gestures
[
DoubleTapGestureRecognizer
]
=
GestureRecognizerFactoryWithHandlers
<
DoubleTapGestureRecognizer
>(
()
=>
DoubleTapGestureRecognizer
(
debugOwner:
this
,
supportedDevices:
supportedDevices
),
(
DoubleTapGestureRecognizer
instance
)
{
...
...
packages/flutter/test/widgets/gesture_detector_test.dart
View file @
4fd27eb6
...
...
@@ -922,6 +922,54 @@ void main() {
expect
(
panDelta
,
isNull
);
expect
(
didEndPan
,
isFalse
);
});
group
(
'DoubleTap'
,
()
{
testWidgets
(
'onDoubleTap is called even if onDoubleTapDown has not been not provided'
,
(
WidgetTester
tester
)
async
{
final
List
<
String
>
log
=
<
String
>[];
await
tester
.
pumpWidget
(
Directionality
(
textDirection:
TextDirection
.
ltr
,
child:
GestureDetector
(
onDoubleTap:
()
=>
log
.
add
(
'double-tap'
),
child:
Container
(
width:
100.0
,
height:
100.0
,
color:
const
Color
(
0xFF00FF00
),
),
),
),
);
await
tester
.
tap
(
find
.
byType
(
Container
));
await
tester
.
pump
(
kDoubleTapMinTime
);
await
tester
.
tap
(
find
.
byType
(
Container
));
await
tester
.
pumpAndSettle
();
expect
(
log
,
<
String
>[
'double-tap'
]);
});
testWidgets
(
'onDoubleTapDown is called even if onDoubleTap has not been not provided'
,
(
WidgetTester
tester
)
async
{
final
List
<
String
>
log
=
<
String
>[];
await
tester
.
pumpWidget
(
Directionality
(
textDirection:
TextDirection
.
ltr
,
child:
GestureDetector
(
onDoubleTapDown:
(
_
)
=>
log
.
add
(
'double-tap-down'
),
child:
Container
(
width:
100.0
,
height:
100.0
,
color:
const
Color
(
0xFF00FF00
),
),
),
),
);
await
tester
.
tap
(
find
.
byType
(
Container
));
await
tester
.
pump
(
kDoubleTapMinTime
);
await
tester
.
tap
(
find
.
byType
(
Container
));
await
tester
.
pumpAndSettle
();
expect
(
log
,
<
String
>[
'double-tap-down'
]);
});
});
}
class
_EmptySemanticsGestureDelegate
extends
SemanticsGestureDelegate
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment