提交 348ac81e authored 作者: shixiaochen's avatar shixiaochen

1、修改BaseListWidget,修复根据获取加载数据大小设置是否可上拉加载;

上级 d524be25
......@@ -21,4 +21,6 @@
## 1.1.0
* 修改BaseListWidget,调用下拉刷新时,禁止手动滚动列表操作;
## 1.1.1
* 修改SearchAppBar,去除输入内容空校验;
\ No newline at end of file
* 修改SearchAppBar,去除输入内容空校验;
## 1.1.2
* 修改BaseListWidget,①修复根据获取加载数据大小设置是否可上拉加载②去除canLoadMore标识(根据获取数据大小判断是否可上拉加载)
\ No newline at end of file
......@@ -13,7 +13,6 @@ class BaseListWidget extends StatefulWidget {
final Footer? footer;
final Widget? startLoadWidget;
final Widget? emptyWidget;
final bool canLoadMore;
final BaseListController? controller;
final bool refreshOnStart; // 首次展示列表是否刷新数据
......@@ -27,7 +26,6 @@ class BaseListWidget extends StatefulWidget {
this.startLoadWidget,
this.controller,
this.emptyWidget,
this.canLoadMore = true, // 是否支持上拉刷新
this.refreshOnStart = true,
}) : super(key: key);
......@@ -98,7 +96,7 @@ class _BaseListWidgetState extends State<BaseListWidget> {
},
),
onRefresh: _onRefresh,
onLoad: widget.canLoadMore ? _onLoad : null,
onLoad: _onLoad,
child: buildScrollView(),
),
// 列表刷新时,增加透明遮罩,禁止滚动列表
......@@ -138,22 +136,15 @@ class _BaseListWidgetState extends State<BaseListWidget> {
}
result ??= [];
if (_page == 1) {
setState(() {
_dataList.clear();
_dataList.addAll(result!);
_count = _dataList.length;
});
_dataList.clear();
_controller.finishRefresh();
_controller.resetFooter();
} else {
setState(() {
_dataList.addAll(result!);
_count = _dataList.length;
});
_controller.finishLoad(result.length < widget.pageSize
? IndicatorResult.noMore
: IndicatorResult.success);
}
_dataList.addAll(result);
_count = _dataList.length;
setState(() {});
_controller.finishLoad(result.length < widget.pageSize
? IndicatorResult.noMore
: IndicatorResult.success);
_stateType = isEmpty ? StateType.empty : StateType.success;
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论