createEmptyView static method
Widget
createEmptyView({
- double iconWidth = 180,
- double iconHeight = 180,
- EdgeInsets margin = EdgeInsets.zero,
- String? emptyText,
- VoidCallback? onTap,
创建空视图,子类可override自定义
Implementation
static Widget createEmptyView({
double iconWidth = 180,
double iconHeight = 180,
EdgeInsets margin = EdgeInsets.zero,
String? emptyText,
VoidCallback? onTap,
}) {
return Container(
width: double.infinity,
margin: margin,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Image.asset(
'packages/zw_basic/assets/images/status_default_empty.png',
width: iconWidth,
height: iconHeight,
fit: BoxFit.cover,
),
Container(
margin: const EdgeInsets.only(top: 16),
child: Text(
emptyText ?? "未获取到相关内容~",
style: const TextStyle(fontSize: 14, color: Color(0xff999999)),
),
),
Container(
margin: const EdgeInsets.only(top: 24),
child: ElevatedButton(
onPressed: () {
onTap?.call();
},
style: ElevatedButton.styleFrom(
backgroundColor: AppColors.primaryColor,
elevation: 2,
padding: const EdgeInsets.only(
left: 16,
top: 10,
right: 16,
bottom: 10,
),
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(24)),
),
),
child: Text(
"重新加载",
style: const TextStyle(fontSize: 14, color: Colors.white),
),
),
),
],
),
);
}