Find out which items in a ListView are visible

DolDurma picture DolDurma · Jul 12, 2019 · Viewed 8.2k times · Source

How can I find out which items are currently visible or invisible in a ListView?
For example, I have 100 items in ListView and when i scroll to top of screen or list, I want to detect which items appear or disappear from the viewport.

Illustration:

enter image description here

Answer

creativecreatorormaybenot picture creativecreatorormaybenot · Jul 12, 2019

There is no easy way to do this. Here is the same question, however, it does not have an answer.

There is an active GitHub issue about this.

There are multiple solutions for the problem in that issue. This Gist features one that requires the rect_getter package.
Alternatively, you could take a look at this proposal.

TL;DR

This is not yet implemented if you are searching for an easy way to find it out. However, there are solutions, like the ones I mentioned above and from other packages, say VisibilityDetector from flutter_widgets.