我已经在SliverList中加载了一些新闻。我想使该列表动态化。如何在下面的代码中使用SliverList添加分页功能?
FutureBuilder<List<Data>>(
future: getNews(),
builder: (context, snapshot){
Widget newsListSliver;
if(snapshot.hasData){
newsListSliver = SliverList(
delegate: new SliverChildBuilderDelegate((context, index){
return new NewsList(latestNews: snapshot.data.elementAt(index),);
}, childCount: snapshot.data.length),
);
}else{
newsListSliver = SliverToBoxAdapter(child: Center(child: CircularProgressIndicator(),));
}
return CustomScrollView(
slivers: <Widget>[
SliverToBoxAdapter(child: new TabPanel()),
SliverToBoxAdapter(child: new UrlButtonPanel()),
SliverToBoxAdapter(child: new ChatNowAd()),
newsListSliver
],
);
},
)