showCustomAlert static method
void
showCustomAlert({
- required BuildContext context,
- required bool? status,
- required String title,
- required String desc,
- required String buttonText,
- required String? buttonTextSecondary,
- VoidCallback? action,
- VoidCallback? actionSecondary,
Implementation
static void showCustomAlert({
required BuildContext context,
required bool? status,
required String title,
required String desc,
required String buttonText,
required String? buttonTextSecondary,
VoidCallback? action,
VoidCallback? actionSecondary,
}) {
Alert(
context: context,
type: status == null ? AlertType.warning : status == true ? AlertType.success : AlertType.error,
title: title,
desc: desc,
style: const AlertStyle(animationType: AnimationType.grow),
buttons: [
DialogButton(
onPressed: () {
Navigator.of(context, rootNavigator: true).pop();
action?.call();
},
width: 120,
child: Text(
buttonText,
style: const TextStyle(color: Colors.white, fontSize: 20),
),
),
if(buttonTextSecondary != null)
DialogButton(
color: Colors.grey,
onPressed: () {
Navigator.of(context, rootNavigator: true).pop();
actionSecondary?.call();
},
width: 120,
child: Text(
buttonTextSecondary,
style: const TextStyle(color: Colors.white, fontSize: 20),
),
),
],
).show();
}