提交 7e78de1f authored 作者: 袁静春's avatar 袁静春

提交:添加加载失败后,重新点击刷新;

上级 00ae16ec
......@@ -124,6 +124,7 @@ class _MyListViewPublicState extends State<MyListViewPublic> {
emptyImg: widget.emptyImg,
hintText: widget.emptyText,
errorImg: widget.errorImg,
onRefresh: callRefresh,
)
: ScrollConfiguration(
//取消列表滑动水波纹
......
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_clx_base/widget/image_widget.dart';
class StateLayout extends StatefulWidget {
final StateType type;
final String? emptyImg;
final String? hintText;
//加载错误,图片
final String? errorImg;
final String? errorImg; //加载错误,图片
final Function? onRefresh;
const StateLayout({
Key? key,
......@@ -15,6 +15,7 @@ class StateLayout extends StatefulWidget {
this.emptyImg,
this.hintText,
this.errorImg,
this.onRefresh,
}) : super(key: key);
@override
......@@ -22,6 +23,7 @@ class StateLayout extends StatefulWidget {
}
class _StateLayoutState extends State<StateLayout> {
@override
Widget build(BuildContext context) {
return SizedBox(
......@@ -62,25 +64,41 @@ class _StateLayoutState extends State<StateLayout> {
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
const SizedBox(height: 30.0),
ImageWidget.loadAssetImage(
img,
width: 133.5*2,
height: 95*2,
),
Text(
hintText,
style: const TextStyle(
color: Color(0xff86909C),
fontSize: 14.0,
fontWeight: FontWeight.normal,
),
),
_getMiddleWidget(img, hintText),
const SizedBox(height: 30.0),
],
);
}
_getMiddleWidget(String img, String hintText) {
List<Widget> listWidget = [
ImageWidget.loadAssetImage(
img,
width: 133.5*2,
height: 95*2,
),
Text(
hintText,
style: const TextStyle(
color: Color(0xff86909C),
fontSize: 14.0,
fontWeight: FontWeight.normal,
),
),
];
var inkWell = InkWell(
onTap: () {
if (widget.onRefresh != null) {
widget.onRefresh;
}
},
child: Column(
children: listWidget,
),
);
return inkWell;
}
}
enum StateType {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论