tester.scrollUntilVisible() not working with GridView in flutter integration testing


I am trying to scroll and find widget from the GridView in integration testing in flutter. But the code not working:

tester.scrollUntilVisible(itemFinder, -100, scrollable: gridViewFinder)

But this is not working. It is saying GridView is not scrollable.


There are few steps I made mistake here:

  1. scrollUntilVisible() is Future, so

    await tester.scrollUntilVisible(…);

  2. to scroll down, delta should be positive:

    await tester.scrollUntilVisible(itemFinder, 100.0, …);

  3. if there is only one list in screen, I don’t have to include scrollable:

    await tester.scrollUntilVisible(itemFinder, 100.0);

Now done! Final answer:

await tester.scrollUntilVisible(itemFinder, 100.0);

Answered By – Khamidjon Khamidov

Leave a Comment