想在ListView外面使用SmartRefresher进行下拉树新和上拉加载更多时,一定要是把ListView直接放在SmartRefresher的child中,否则会无法触发
return prefix0.SmartRefresher(
footer: prefix0.CustomFooter(
builder: (BuildContext context, prefix0.LoadStatus mode) {
Widget body;
if (mode == prefix0.LoadStatus.loading) {
body =Text("正在加载...");
}else {
body =Text("没有更多数据了");
}
return Container(
height:55.0,
child:Center(child: body),
);
},
),
controller:_refresh,
enablePullDown:false,
enablePullUp:true,
onLoading: ()async {
//加载更多
},
child:ListView.builder(
controller:_controller,
itemCount:_messages.length,
shrinkWrap:true,
reverse:true,
itemBuilder: (BuildContext context, int index) {
return _messageContainer(_messages[index]);
},
),
);