kemptyView function
空页面
list
集合
emptyText
空页面显示文案
emptyImagePath
空页面显示的图片地址
Implementation
Widget kemptyView(
Iterable? list,
Widget child,
String emptyText, {
TextStyle? emptyTextStyle,
String? emptyImagePath,
}) {
if (list != null && list.isNotEmpty) {
return child;
} else {
return Stack(
children: [
Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Image.asset(emptyImagePath ?? "")
.kshow(emptyImagePath != null && emptyImagePath.isNotEmpty),
SizedBox(height: 30.h)
.kshow(emptyImagePath != null && emptyImagePath.isNotEmpty),
Text(emptyText,
style: emptyTextStyle ??
TextStyle(color: Colors.black, fontSize: 14.sp))
],
),
),
child
],
);
}
}