customAlertDialog function
dynamic
customAlertDialog(
- BuildContext context,
- Widget title,
- Widget content, {
- Widget? titleIcon,
- String? positiveButtonText,
- Function? positiveButtonAction,
- String? negativeButtonText,
- Function? negativeButtonAction,
- String? neutralButtonText,
- Function? neutralButtonAction,
- bool hideNeutralButton = false,
- bool closeOnBackPress = false,
- bool confirmationDialog = false,
- String? confirmationMessage,
customAlertDialog function with title
and content
widgets
positiveButtonText
for positive button text
negativeButtonText
for negative button text
neutralButtonText
for negative button text
hideNeutralButton
to hide the Neutral Button default is false
closeOnBackPress
to close dialog on back button default is false
confirmationDialog
to make the confirmation dialog default is false
confirmationMessage
confirmation message default is 'Please check this box for Confirmation!'
Implementation
customAlertDialog(
BuildContext context,
Widget title,
Widget content, {
Widget? titleIcon,
String? positiveButtonText,
Function? positiveButtonAction,
String? negativeButtonText,
Function? negativeButtonAction,
String? neutralButtonText,
Function? neutralButtonAction,
bool hideNeutralButton = false,
bool closeOnBackPress = false,
bool confirmationDialog = false,
String? confirmationMessage,
}) {
return showGeneralDialog(
context: context,
barrierDismissible: closeOnBackPress,
barrierLabel: "",
barrierColor: getBarrierColor(),
transitionDuration: getDialogPopUpAnimationDuration(),
transitionBuilder: (c2, a1, a2, widget) {
return getDialogAnimation(a1, a2, widget);
},
pageBuilder: (c1, a1, a2) => WillPopScope(
child: SimpleAlertDialog(
title,
content,
icon: titleIcon,
negativeButtonText: negativeButtonText,
negativeButtonAction: negativeButtonAction,
positiveButtonText: positiveButtonText,
positiveButtonAction: positiveButtonAction,
neutralButtonText: neutralButtonText,
neutralButtonAction: neutralButtonAction,
hideNeutralButton: hideNeutralButton,
confirmationDialog: confirmationDialog,
confirmationMessage: confirmationMessage,
),
onWillPop: () async => closeOnBackPress,
),
);
}