mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Add secondary tap capabilities to TableRowInkWell (#123036)
Added new parameters onSecondaryTap and onSecondaryTapDown
This commit is contained in:
parent
a5fc8b2bd4
commit
63e30480cd
@ -1189,6 +1189,8 @@ class TableRowInkWell extends InkResponse {
|
||||
super.onDoubleTap,
|
||||
super.onLongPress,
|
||||
super.onHighlightChanged,
|
||||
super.onSecondaryTap,
|
||||
super.onSecondaryTapDown,
|
||||
super.overlayColor,
|
||||
super.mouseCursor,
|
||||
}) : super(
|
||||
|
||||
@ -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);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user