fluttercandies / flutter_scrollview_observer

A widget for observing data related to the child widgets being displayed in a ScrollView. Maintainer: @LinXunFeng
https://pub.dev/packages/scrollview_observer
MIT License
438 stars 47 forks source link

请问怎么根据滑动的距离计算出最近的一个index #85

Closed CookerMa closed 4 months ago

LinXunFeng commented 4 months ago

不太明白你的意思,请举例说明

CookerMa commented 4 months ago

就是歌词的那种效果,但是每个item高度不一样,滑动一段距离之后,滚动到中间

https://github.com/fluttercandies/flutter_scrollview_observer/assets/10025209/4ee3f67c-9692-4d75-b907-d1bd1bcce26f

LinXunFeng commented 4 months ago

ListViewObserverleadingOffset 的值设置为屏幕中间虚线的偏移量就可以了。

image