tap method
Future<void>
tap({
- SettlePolicy? settlePolicy,
- Duration? visibleTimeout,
- Duration? settleTimeout,
- Alignment alignment = Alignment.center,
Waits until this finder finds at least 1 visible widget and then taps on it.
Example:
// taps on the first widget having Key('createAccount')
await $(#createAccount).tap();
If the finder finds more than 1 widget, you can choose which one to tap on:
// taps on the third TextButton widget
await $(TextButton).at(2).tap();
This method automatically calls WidgetTester.pumpAndSettle after
tapping. If you want to disable this behavior, set settlePolicy to
SettlePolicy.noSettle.
See also:
- PatrolFinder.waitUntilVisible, which is used to wait for the widget to appear
- WidgetController.tap
Implementation
Future<void> tap({
SettlePolicy? settlePolicy,
Duration? visibleTimeout,
Duration? settleTimeout,
Alignment alignment = Alignment.center,
}) => wrapWithPatrolLog(
action: 'tap',
color: AnsiCodes.yellow,
function: () => tester.tap(
this,
settlePolicy: settlePolicy,
visibleTimeout: visibleTimeout,
settleTimeout: settleTimeout,
alignment: alignment,
enablePatrolLog: false,
),
);