crasowas / easy_sticky_header

An easy-to-use and powerful sticky header for any widget that supports scrolling.
https://pub.dev/packages/easy_sticky_header
MIT License
19 stars 5 forks source link

WidgetsBinding需要添加? #1

Closed liangdas closed 2 years ago

liangdas commented 2 years ago

WidgetsBinding?.instance.addPostFrameCallback((timeStamp) { _controller?.scrollListener(); });

crasowas commented 2 years ago

WidgetsBinding?.instance.addPostFrameCallback((timeStamp) { _controller?.scrollListener(); });

使用addPostFrameCallback的原因是StickyHeader先于包裹的滚动组件更新,如果不延后执行scrollListener方法,那么获取的StickyHeaderInfo是滚动组件更新前的数据。