kemptyView function

Widget kemptyView(
  1. Iterable? list,
  2. Widget child,
  3. String emptyText, {
  4. TextStyle? emptyTextStyle,
  5. String? emptyImagePath,
})

空页面 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.kisNotBlank()),
              SizedBox(height: 30.h).kshow(emptyImagePath.kisNotBlank()),
              Text(emptyText, style: emptyTextStyle ?? Font.black_14)
            ],
          ),
        ),
        child
      ],
    );
  }
}