scroll-to-index icon indicating copy to clipboard operation
scroll-to-index copied to clipboard

Is there a way to listen to the current index which is in the viewport?

Open mark8044 opened this issue 4 years ago • 2 comments

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

mark8044 avatar Nov 19 '21 23:11 mark8044

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;

jerrywell avatar Dec 08 '21 09:12 jerrywell