showConfirmationMessage static method
dynamic
showConfirmationMessage(
- BuildContext context,
- String? alertTitle,
- String? alertMessage, {
- MessageType messageType = MessageType.none,
- dynamic onApplyTapped()?,
- Color buttonIconColor = Colors.indigo,
Implementation
static showConfirmationMessage(
BuildContext context,
String? alertTitle,
String? alertMessage, {
MessageType messageType = MessageType.none,
Function()? onApplyTapped,
Color buttonIconColor = Colors.indigo,
}) {
Color textColor = Colors.black;
if (messageType == MessageType.success) {
textColor = Colors.green;
} else if (messageType == MessageType.info) {
textColor = Colors.indigo;
} else if (messageType == MessageType.warning) {
textColor = Colors.yellow;
} else if (messageType == MessageType.error) {
textColor = Colors.red;
}
double dialongViewScale = 0.8;
if (!DynamoCommons.isMobile(context)) {
dialongViewScale = 0.40;
}
showDialog(
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: SizedBox(
width: MediaQuery.of(context).size.width * dialongViewScale,
child: Text(
alertTitle!,
style: TextStyle(
fontFamily: 'Montserrat',
fontSize: 18.0,
fontWeight: FontWeight.bold,
),
),
),
content: SizedBox(
width: MediaQuery.of(context).size.width * dialongViewScale,
child: Text(
alertMessage!,
style: TextStyle(
fontFamily: 'Montserrat',
fontSize: 18.0,
color: textColor,
),
),
),
actions: [
Padding(
padding: const EdgeInsets.only(left: 20, right: 20),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
getFineRoundedButton(
"Yes",
() {
if (onApplyTapped != null) {
onApplyTapped();
}
Navigator.of(context).pop();
},
Icon(
Icons.check,
color: buttonIconColor,
),
),
getFineRoundedButton(
"No",
() {
Navigator.of(context).pop();
},
Icon(
Icons.close,
color: buttonIconColor,
),
),
],
),
),
],
);
});
}