CommonDialog.normal constructor

CommonDialog.normal({
  1. Key? key,
  2. required BuildContext context,
  3. bool showTitle = true,
  4. String? title,
  5. TextAlign? titleAlign,
  6. Widget? contentChild,
  7. String? content,
  8. TextAlign? contentAlign,
  9. bool showOneButton = false,
  10. String? cancelButton,
  11. String? confirmButton,
  12. VoidCallback? onCancel,
  13. VoidCallback? onConfirm,
  14. bool disableCloseEvent = false,
  15. 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();
          });