showAlertDialog function

Future showAlertDialog({
  1. required BuildContext context,
  2. String? title,
  3. String? message,
  4. List<Widget>? actions,
})

Implementation

Future showAlertDialog(
    {required BuildContext context,
    String? title,
    String? message,
    List<Widget>? actions}) async {
  var result = await showDialog(
    context: context,
    builder: (context) => AlertDialog(
      title: Text(title ?? ""),
      content: Text(message ?? ""),
      actions: (actions?.isEmpty ?? true)
          ? <Widget>[
              TextButton(
                child: Text(appLocalizationsWrapper.lang.ok.toUpperCase()),
                onPressed: () => Navigator.of(context).pop(),
              )
            ]
          : actions,
    ),
  );
  return result;
}