I have a SingleChildScrollView
that contains some widgets inside it. I want to listen if a widget becomes visible on the screen. is there any widget or sample code for this scenario?
Asked
Active
Viewed 2,348 times
1

reza
- 1,354
- 1
- 7
- 25
-
1Try these answer [here](https://stackoverflow.com/questions/51069712/how-to-know-if-a-widget-is-visible-within-a-viewport) someone asked the same question. – Victor Ephraim Dec 29 '21 at 11:58
1 Answers
0
One package might be helpful is VisibilityDetector. You should be able to wrap around your child widget like this and execute callbacks
VisibilityDetector(
key: Key('my-widget-key'),
onVisibilityChanged: (visibilityInfo) {
var visiblePercentage = visibilityInfo.visibleFraction * 100;
debugPrint(
'Widget ${visibilityInfo.key} is ${visiblePercentage}% visible');
},
child: someOtherWidget,
);

Brian Wang
- 20
- 5