quire-io / scroll-to-index

scroll to index with fixed/variable row height inside Flutter scrollable widget
MIT License
518 stars 105 forks source link

[Feature request] Checking if widget is currently scrolled to top #36

Closed amitkot closed 3 years ago

amitkot commented 3 years ago

It would be very useful for me to be able to check if a widget wrapped with an AutoScrollTag is currently scrolled to the top of the screen. Can this be achieved with the current implementation?

My use case

I use a CustomScrollView in my app with groups of items - each one with a header. The headers are wrapped with an AutoScrollTag widget. When tapped - the headers are scrolled to the top of the screen.

I want to have a different behavior when the header is tapped according to its scroll position:

jerrywell commented 3 years ago

you can get it via https://github.com/flutter/flutter/issues/19941#issuecomment-486950990. in this way, you can check if it's at the specified coordination.

another solution is: maybe you can simply scroll it every time and compare the scroll offset with before to check if it moved. if not, minimize the following items.

amitkot commented 3 years ago

another solution is: maybe you can simply scroll it every time and compare the scroll offset with before to check if it moved. if not, minimize the following items.

This worked wonderfully for me, thanks!