Making.School.Asignment.app/lib/page/global_widget/MyEmptyWidget.dart

63 lines
1.6 KiB
Dart

/*
* @Descripttion:
* @version:
* @Author: wy
* @Date: 2020-07-01 15:45:15
* @LastEditors: wangyang 1147192855@qq.com
* @LastEditTime: 2022-07-19 11:14:07
*/
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
class MyEmptyWidget extends StatelessWidget {
static const String defText = "抱歉,暂无内容";
static const String defimg = "assets/images/not_data_bgm2.png";
final String? textVal;
final String? imgAssetPath;
final AlignmentGeometry alignment;
final EdgeInsets? padding;
final double? imgWidth;
final double? imgHeight;
final double? font;
const MyEmptyWidget(
{this.imgWidth,
this.imgHeight,
this.textVal,
this.padding,
this.imgAssetPath,
this.font,
this.alignment = Alignment.center,
Key? key})
: super(key: key);
@override
Widget build(BuildContext context) {
return Container(
padding: padding ?? EdgeInsets.only(bottom: 40.r),
alignment: alignment,
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Opacity(
opacity: 0.6,
child: Image.asset(
imgAssetPath ?? defimg,
fit: BoxFit.cover,
width: imgWidth ?? 150.w,
height: imgHeight ?? 150.w,
),
),
Padding(
padding: EdgeInsets.only(top: 5.h),
child: Text(
textVal ?? defText,
style: TextStyle(fontSize: font ?? 12.sp, color: const Color(0xB2898B8D)),
),
)
],
),
);
}
}