Create WidgetTester.ensureVisible(Finder) (#22620)

This is just a shorthand for
Scrollable.ensureVisible(tester.element(finder))

Fixes #8185
This commit is contained in:
Dinesh Ahuja
2018-10-19 00:47:47 +05:30
committed by Todd Volkert
parent d5777b6a9a
commit 7fbb5b9f32
2 changed files with 30 additions and 0 deletions

View File

@@ -677,6 +677,12 @@ class WidgetTester extends WidgetController implements HitTestDispatcher, Ticker
SemanticsHandle ensureSemantics() {
return binding.pipelineOwner.ensureSemantics();
}
/// Given a widget `W` specified by [finder] and a [Scrollable] widget `S` in
/// its ancestry tree, this scrolls `S` so as to make `W` visible.
///
/// Shorthand for `Scrollable.ensureVisible(tester.element(finder))`
Future<void> ensureVisible(Finder finder) => Scrollable.ensureVisible(element(finder));
}
typedef _TickerDisposeCallback = void Function(_TestTicker ticker);