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

Commit 4df5508

Browse files
InkResponse enable if onTapDown is not null (#96224)
1 parent 56a7c97 commit 4df5508

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

packages/flutter/lib/src/material/ink_well.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1032,7 +1032,7 @@ class _InkResponseState extends State<_InkResponseStateWidget>
10321032
}
10331033

10341034
bool _isWidgetEnabled(_InkResponseStateWidget widget) {
1035-
return widget.onTap != null || widget.onDoubleTap != null || widget.onLongPress != null;
1035+
return widget.onTap != null || widget.onDoubleTap != null || widget.onLongPress != null || widget.onTapDown != null;
10361036
}
10371037

10381038
bool get enabled => _isWidgetEnabled(widget);

packages/flutter/test/material/ink_well_test.dart

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,26 @@ void main() {
7676
expect(log, equals(<String>['tap-down', 'tap-cancel']));
7777
});
7878

79+
testWidgets('InkWell only onTapDown enables gestures', (WidgetTester tester) async {
80+
// Regression test for https://github.com/flutter/flutter/issues/96030
81+
bool downTapped = false;
82+
await tester.pumpWidget(Directionality(
83+
textDirection: TextDirection.ltr,
84+
child: Material(
85+
child: Center(
86+
child: InkWell(
87+
onTapDown: (TapDownDetails details) {
88+
downTapped = true;
89+
},
90+
),
91+
),
92+
),
93+
));
94+
95+
await tester.tap(find.byType(InkWell));
96+
expect(downTapped, true);
97+
});
98+
7999
testWidgets('InkWell invokes activation actions when expected', (WidgetTester tester) async {
80100
final List<String> log = <String>[];
81101

0 commit comments

Comments
 (0)