修复 加载无法结束的问题

hmxc
张萌 4 years ago
parent c6ee2c5817
commit f8226a7040

@ -18,6 +18,17 @@ class BussinessAndFixView extends StatefulWidget {
class _BussinessAndFixViewState extends State<BussinessAndFixView>
with AutomaticKeepAliveClientMixin {
EasyRefreshController _easyRefreshController;
@override
void initState() {
super.initState();
_easyRefreshController = EasyRefreshController();
}
@override
void dispose() {
_easyRefreshController?.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {

@ -89,6 +89,7 @@ class _BeeListViewState<T> extends State<BeeListView> {
@override
Widget build(BuildContext context) {
return EasyRefresh(
enableControlFinishLoad: true,
controller: widget.controller,
header: MaterialHeader(
valueColor: AlwaysStoppedAnimation(AppStyle.primaryColor),
@ -111,10 +112,15 @@ class _BeeListViewState<T> extends State<BeeListView> {
widget.path,
params: _params,
);
_models.addAll(widget.convert(_model) as List<T>);
// if (_pageNum >= _model.pageCount) {
widget.controller.finishLoad();
// }
if (_pageNum <= _model.pageCount) {
_models.addAll(widget.convert(_model) as List<T>);
}
if (_pageNum >= _model.pageCount) {
widget.controller.finishLoad(
success: true,
noMore: true,
);
}
setState(() {});
},
child: widget.builder(_models),

Loading…
Cancel
Save