Add secondary tap capabilities to TableRowInkWell (#123036)

Added new parameters onSecondaryTap and onSecondaryTapDown
This commit is contained in:
Justin McCandless 2023-03-31 09:42:16 -07:00 committed by GitHub
parent a5fc8b2bd4
commit 63e30480cd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 47 additions and 1 deletions

View file

@ -1189,6 +1189,8 @@ class TableRowInkWell extends InkResponse {
super.onDoubleTap,
super.onLongPress,
super.onHighlightChanged,
super.onSecondaryTap,
super.onSecondaryTapDown,
super.overlayColor,
super.mouseCursor,
}) : super(

View file

@ -2070,6 +2070,51 @@ void main() {
e.toString().contains('dataRowHeight == null || (dataRowMinHeight == null && dataRowMaxHeight == null)'))));
});
group('TableRowInkWell', () {
testWidgets('can handle secondary taps', (WidgetTester tester) async {
bool secondaryTapped = false;
bool secondaryTappedDown = false;
await tester.pumpWidget(MaterialApp(
home: Material(
child: Table(
children: <TableRow>[
TableRow(
children: <Widget>[
TableRowInkWell(
onSecondaryTap: () {
secondaryTapped = true;
},
onSecondaryTapDown: (TapDownDetails details) {
secondaryTappedDown = true;
},
child: const SizedBox(
width: 100.0,
height: 100.0,
),
),
],
),
],
),
),
));
expect(secondaryTapped, isFalse);
expect(secondaryTappedDown, isFalse);
expect(find.byType(TableRowInkWell), findsOneWidget);
await tester.tap(
find.byType(TableRowInkWell),
buttons: kSecondaryMouseButton,
);
await tester.pumpAndSettle();
expect(secondaryTapped, isTrue);
expect(secondaryTappedDown, isTrue);
});
});
testWidgets('Heading cell cursor resolves MaterialStateMouseCursor correctly', (WidgetTester tester) async {
await tester.pumpWidget(
MaterialApp(
@ -2233,5 +2278,4 @@ void main() {
// Test that cursor is updated for the row.
expect(RendererBinding.instance.mouseTracker.debugDeviceActiveCursor(1), SystemMouseCursors.copy);
});
}