showIKnowAlert static method

Future showIKnowAlert(
  1. BuildContext? context, {
  2. bool barrierDismissible = false,
  3. String? title,
  4. String? message,
  5. RichText? richTextWidget,
  6. String? confirmText,
  7. TextAlign? messageAlign,
  8. bool showCloseButton = true,
  9. void iKnowHandle()?,
  10. bool? scrollable,
})

我知道了 context可空

Implementation

static Future showIKnowAlert(
  BuildContext? context, {
  bool barrierDismissible = false,
  String? title,
  String? message,
  RichText? richTextWidget,
  String? confirmText,
  TextAlign? messageAlign,
  bool showCloseButton = true,
  void Function()? iKnowHandle,
  bool? scrollable,
}) {
  if (context == null) {
    context = OverlayInit.contextGetBlock?.call();
  }
  if (context == null) {
    debugPrint('🚗🚗🚗 alert context is null, 请插入context或者执行OverlayInit');
    return Future(() => false);
  }

  return showAlert(
    context,
    barrierDismissible: barrierDismissible,
    alertViewBulider: (context) {
      return IKnowMessageAlertView(
        title: title,
        message: message,
        richTextWidget: richTextWidget,
        messageAlign: messageAlign,
        iKnowTitle: confirmText ?? "我知道了",
        barrierDismissible: barrierDismissible,
        showCloseButton: showCloseButton,
        iKnowHandle: () {
          Navigator.pop(context);
          if (iKnowHandle != null) {
            iKnowHandle();
          }
        },
        scrollable: scrollable,
      );
    },
  );
}