InkResponse enable if onTapDown is not null (#96224)

This commit is contained in:
Markus Aksli
2022-01-10 23:00:19 +02:00
committed by GitHub
parent 56a7c97fd8
commit 4df55087c1
2 changed files with 21 additions and 1 deletions

View File

@@ -1032,7 +1032,7 @@ class _InkResponseState extends State<_InkResponseStateWidget>
}
bool _isWidgetEnabled(_InkResponseStateWidget widget) {
return widget.onTap != null || widget.onDoubleTap != null || widget.onLongPress != null;
return widget.onTap != null || widget.onDoubleTap != null || widget.onLongPress != null || widget.onTapDown != null;
}
bool get enabled => _isWidgetEnabled(widget);

View File

@@ -76,6 +76,26 @@ void main() {
expect(log, equals(<String>['tap-down', 'tap-cancel']));
});
testWidgets('InkWell only onTapDown enables gestures', (WidgetTester tester) async {
// Regression test for https://github.com/flutter/flutter/issues/96030
bool downTapped = false;
await tester.pumpWidget(Directionality(
textDirection: TextDirection.ltr,
child: Material(
child: Center(
child: InkWell(
onTapDown: (TapDownDetails details) {
downTapped = true;
},
),
),
),
));
await tester.tap(find.byType(InkWell));
expect(downTapped, true);
});
testWidgets('InkWell invokes activation actions when expected', (WidgetTester tester) async {
final List<String> log = <String>[];