showAlert static method

AlertHandler showAlert(
  1. AlertInfo info,
  2. BuildContext context, {
  3. Color? barrierColor,
  4. bool showContent = true,
  5. bool useRootNavigator = false,
})

Implementation

static AlertHandler showAlert(
  AlertInfo info,
  BuildContext context, {
  Color? barrierColor,
  bool showContent = true,
  bool useRootNavigator = false,
}) {
  final id = AtomicAlertDialog.showWithConfig(
    context,
    enableHide: true,
    rootOverlay: useRootNavigator,
    config: AlertDialogConfig(
      title: '',
      content: info.description,
      itemList: info.itemList,
      cancelConfig: info.cancelText?.isNotEmpty == true
          ? ButtonConfig(
              text: info.cancelText!,
              onClick: info.cancelCallback,
            )
          : null,
      confirmConfig: info.defaultText?.isNotEmpty == true
          ? ButtonConfig(
              text: info.defaultText!,
              type: info.isDestructive ? TextColorPreset.red : TextColorPreset.blue,
              onClick: info.defaultCallback,
            )
          : null,
    ),
  );
  AlertHandler alertHandler = AlertHandler(handID: id);
  alertHandler.setContentVisible(showContent);
  return alertHandler;
}