showAlertDialog static method

void showAlertDialog({
  1. required BuildContext context,
  2. List<Widget>? titleRowWidgets,
  3. Widget? content,
  4. List<Widget>? actions,
  5. Color? barrierColor,
  6. Color? backgroundColor,
  7. bool barrierDismissible = true,
  8. EdgeInsets? insetPadding,
  9. dynamic onDismiss,
})

Show alert dialog with various components

Implementation

static void showAlertDialog(
    {required BuildContext context,
    List<Widget>? titleRowWidgets,
    Widget? content,
    List<Widget>? actions,
    Color? barrierColor,
    Color? backgroundColor,
    bool barrierDismissible = true,
    EdgeInsets? insetPadding,
    onDismiss}) {
  if (titleRowWidgets == null) titleRowWidgets = [];
  showDialog(
      context: context,
      barrierDismissible: barrierDismissible,
      barrierColor: barrierColor,
      builder: (context) => new AlertDialog(
            title: Row(children: titleRowWidgets!),
            content: content,
            actions: actions,
            backgroundColor: backgroundColor,
            insetPadding: insetPadding,
          )).then((value) => {
        if (onDismiss != null)
          onDismiss()
        else
          Navigator.of(context).pop(false)
      });
}