rvamsikrishna / inview_notifier_list

A Flutter package that builds a list view and notifies when the widgets are on screen.
MIT License
676 stars 103 forks source link

How to use EasyRefresh #14

Open zhongcg opened 4 years ago

zhongcg commented 4 years ago

@override Widget build(BuildContext context) { return NotificationListener( onNotification: (notification) { if (notification is ScrollEndNotification) { isTouch = false; setState(() {}); } if (notification is ScrollStartNotification) { isTouch = true; } return false; }, child: LoadStateLayout( state: _loadState, errorRetry: _onRefresh, emptyRetry: _onRefresh, successWidget: EasyRefresh( onRefresh: _onRefresh, onLoad: _loadMore, child: getListView(context)))); }

getListView(BuildContext context) { return InViewNotifierCustomScrollView( shrinkWrap: true, initialInViewIds: ['0'], isInViewPortCondition: (double deltaTop, double deltaBottom, double viewPortDimension) { return deltaTop < (0.5 viewPortDimension) && deltaBottom > (0.5 viewPortDimension); }, controller: _scrollController, slivers: [ SliverList( delegate: SliverChildBuilderDelegate( (context, index) { GlobalKey bottomKey = GlobalKey(); return InViewNotifierWidget( id: '$index', builder: (BuildContext context, bool isInView, Widget child) { final String inViewTxt = isInView ? 'inView' : 'notInView'; print('$inViewTxt $index'); return buildItems( videolist[index], bottomKey, isInView); }, ); }, childCount: videolist.length, ), ) ]);

zhongcg commented 4 years ago

can not change isInView Index . isInView index still 0

rvamsikrishna commented 4 years ago

I could not understand your question completely. Can you elaborate?

sdegenaar commented 3 years ago

Hi, I can confirm that EasyRefresh is working if you enable in InViewNotifierList shrinkWrap: true, physics: ScrollPhysics(),

but the isInView does not change

zhujiahong commented 3 years ago

Hi, I can confirm that EasyRefresh is working if you enable in InViewNotifierList shrinkWrap: true, physics: ScrollPhysics(),

but the isInView does not change

I ran into the same problem ,when I add
shrinkWrap: true, physics: ScrollPhysics(), isInView can not working

sdegenaar75 commented 3 years ago

yep be nice to get this working. I have tried lots of things. Let me know if you have any success or the author has any ideas. Thanks

sdegenaar75 commented 3 years ago

Hi, any news on this or suggestions? Thanks!