scroll-to-index
scroll-to-index copied to clipboard
Is there a way to listen to the current index which is in the viewport?
Is there a way to listen to the current index which is in the viewport?
This could be very useful to trigger actions when an index is inside the viewport
refer to https://github.com/quire-io/scroll-to-index/blob/master/lib/scroll_to_index.dart#L481,
the concept is that you will get the offset to reveal the target widget based on alignment 0 and 1 (means the top and bottom of the viewport).
the code should be like: (never really try it in code, you can follow this concept doing the experiment)
final isInViewport = _offsetToRevealInViewport(10, 0) => 0 && _offsetToRevealInViewport(10, 0) <= 0;