CommonDialog.normal constructor
CommonDialog.normal({
- Key? key,
- required BuildContext context,
- bool showTitle = true,
- String? title,
- TextAlign? titleAlign,
- Widget? contentChild,
- String? content,
- TextAlign? contentAlign,
- bool showOneButton = false,
- String? cancelButton,
- String? confirmButton,
- VoidCallback? onCancel,
- VoidCallback? onConfirm,
- bool disableCloseEvent = false,
- bool dismissOnConfirmBtnClicked = true,
一般类型弹窗。包含默认的标题"温馨提示",自定义内容content,左下角"取消"按钮,右下角"确定"按钮
Implementation
CommonDialog.normal(
{Key? key,
required BuildContext context,
bool showTitle = true, //是否显示标题
String? title, //标题。默认"温馨提示"
TextAlign? titleAlign,
Widget? contentChild, //自定义content内容
String? content, //内容
TextAlign? contentAlign,
bool showOneButton = false, //ture:只显示一个按钮。此时单独传cancelButton或confirmButton可以展示对应按钮样式
String? cancelButton, //左下角按钮,默认"取消"
String? confirmButton, //右下角按钮,默认"确定"
VoidCallback? onCancel,
VoidCallback? onConfirm,
bool disableCloseEvent = false,
bool dismissOnConfirmBtnClicked = true})
: this(
key: key,
contentChild: contentChild,
title: showTitle ? title ?? Strings.rechargePageChannelTips.tr : null,
titleAlign: titleAlign,
contentAlign: contentAlign,
content: content,
leftButton: showOneButton && cancelButton == null ? null : cancelButton ?? Strings.dialogNegative.tr,
rightButton: showOneButton && confirmButton == null ? null : confirmButton ?? Strings.dialogPositive.tr,
disableCloseEvent: disableCloseEvent,
onRightButtonPressed: () {
if(dismissOnConfirmBtnClicked){
Navigator.pop(context);
}
onConfirm?.call();
},
onLeftButtonPressed: () {
Navigator.pop(context);
onCancel?.call();
});