dragUntilVisible method Null safety
Repeatedly drags view
by moveStep
until finder
is visible.
Between each drag, advances the clock by duration
.
Throws a StateError if finder
is not found after maxIteration
drags.
See also:
- scrollUntilVisible, which wraps this method with an API that is more convenient when dealing with a Scrollable.
Implementation
Future<void> dragUntilVisible(
Finder finder,
Finder view,
Offset moveStep, {
int maxIteration = 50,
Duration duration = const Duration(milliseconds: 50),
}) {
return TestAsyncUtils.guard<void>(() async {
while (maxIteration > 0 && finder.evaluate().isEmpty) {
await drag(view, moveStep);
await pump(duration);
maxIteration -= 1;
}
await Scrollable.ensureVisible(element(finder));
});
}