CommonDialog constructor
CommonDialog({
- Key? key,
- Widget? contentChild,
- String? title,
- TextAlign? titleAlign,
- TextStyle? titleStyle,
- double? titleFontSize,
- Color? titleColor,
- String? content,
- TextAlign? contentAlign,
- TextStyle? contentStyle,
- double? contentFontSize,
- Color? contentColor,
- String? leftButton,
- TextStyle? leftButtonTextStyle,
- VoidCallback? onLeftButtonPressed,
- String? rightButton,
- TextStyle? rightButtonTextStyle,
- VoidCallback? onRightButtonPressed,
- bool disableCloseEvent = false,
Implementation
CommonDialog(
{Key? key,
Widget? contentChild, //自定义content内容
String? title, //标题。传null不显示
TextAlign? titleAlign,
TextStyle? titleStyle, //标题自定义样式
double? titleFontSize, //标题字体大小。优先由titleStyle控制
Color? titleColor, //标题字体颜色。优先由titleStyle控制
String? content, //内容。传null不显示
TextAlign? contentAlign,
TextStyle? contentStyle, //内容自定义样式
double? contentFontSize, //内容字体大小。优先由contentStyle控制
Color? contentColor, //内容字体颜色。优先由contentStyle控制
String? leftButton, //左下按钮。传null不显示
TextStyle? leftButtonTextStyle, //左下按钮样式
VoidCallback? onLeftButtonPressed, //左下按钮点击回调
String? rightButton, //右下按钮
TextStyle? rightButtonTextStyle, //右下按钮样式
VoidCallback? onRightButtonPressed, //右下按钮点击回调
bool disableCloseEvent = false // 是否屏蔽外部的关闭事件(默认:不屏蔽)
})
: super(
key: key,
backgroundColor: Colors.white,
alignment: Alignment.center,
insetPadding: EdgeInsets.zero,
insetAnimationCurve: Curves.easeInToLinear,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16)),
child: WillPopScope(
child: SizedBox(
width: ScreenUtils.screenWidthInDp() * 0.74,
child: _DialogView(
title: title,
titleAlign: titleAlign,
contentAlign: contentAlign,
titleStyle: titleStyle,
titleFontSize: titleFontSize,
titleColor: titleColor,
content: content,
contentStyle: contentStyle,
contentFontSize: contentFontSize,
contentColor: contentColor,
leftButton: leftButton,
leftButtonTextStyle: leftButtonTextStyle,
onLeftButtonPressed: onLeftButtonPressed,
rightButton: rightButton,
rightButtonTextStyle: rightButtonTextStyle,
onRightButtonPressed: onRightButtonPressed,
contentChild: contentChild)),
onWillPop: () => Future<bool>.value(!disableCloseEvent)));