提交 5416d3b5 authored 作者: shixiaochen's avatar shixiaochen

1、修复BaseListWidget展示多个loading问题

上级 b85f0a03
......@@ -36,4 +36,6 @@
* 网络请求兼容code整形、字符串判断
* ## 1.1.8
* 网络请求兼容data返回null
* ## 1.1.9
* 修复BaseListWidget展示多个loading问题
\ No newline at end of file
......@@ -236,6 +236,7 @@ class _BaseListWidgetState extends State<BaseListWidget> {
emptyImg: "default_drawing_1",
errorImg: "default_drawing_5",
onRefresh: _controller.reload,
loadingWidget: const SizedBox(),
);
},
childCount: 1,
......
......@@ -6,8 +6,9 @@ class StateLayout extends StatefulWidget {
final StateType type;
final String? emptyImg;
final String? hintText;
final String? errorImg; //加载错误,图片
final String? errorImg; //加载错误,图片
final Function? onRefresh;
final Widget? loadingWidget;
const StateLayout({
Key? key,
......@@ -16,6 +17,7 @@ class StateLayout extends StatefulWidget {
this.hintText,
this.errorImg,
this.onRefresh,
this.loadingWidget,
}) : super(key: key);
@override
......@@ -23,13 +25,13 @@ class StateLayout extends StatefulWidget {
}
class _StateLayoutState extends State<StateLayout> {
@override
Widget build(BuildContext context) {
return SizedBox(
width: double.infinity,
child:
widget.type == StateType.loading ? _loadingWidget() : _otherWidget(),
child: widget.type == StateType.loading
? widget.loadingWidget ?? _loadingWidget()
: _otherWidget(),
);
}
......@@ -70,11 +72,13 @@ class _StateLayoutState extends State<StateLayout> {
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
const SizedBox(height: 30.0),
img != null && img.isNotEmpty ?ImageWidget.loadAssetImage(
img,
width: 133.5*2,
height: 95*2,
): const SizedBox(),
img != null && img.isNotEmpty
? ImageWidget.loadAssetImage(
img,
width: 133.5 * 2,
height: 95 * 2,
)
: const SizedBox(),
Text(
hintText,
style: const TextStyle(
......@@ -88,7 +92,6 @@ class _StateLayoutState extends State<StateLayout> {
),
);
}
}
enum StateType {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论