peng8350 / flutter_pulltorefresh

a widget provided to the flutter scroll component drop-down refresh and pull up load.
MIT License
2.71k stars 722 forks source link

Using AnimatedList rather than ListView broke the functionality of Pull to refresh. #276

Closed jigarpatel17 closed 4 years ago

jigarpatel17 commented 4 years ago

When I have used AnimatedList instead of ListView for showing data in listing, it seems like SmartRefresher unable to handle pull to refresh.

SmartRefresher(
    enablePullDown: true,
    header: WaterDropHeader(),
    controller: _refreshController,
    onRefresh: _onRefresh,
    onLoading: _onLoading,
    child: AnimatedList(
          initialItemCount: 100,
          itemBuilder: (context, index, animation) =>
              _buildItem(context, 'data: ${index + 1}', animation),
          ),
)

Is there any one to keep both the things together?

peng8350 commented 4 years ago

It can work with AnimatedList,But your usage has mistake,you must use CustomScrollView+SliverAnimatedList,see here