showPumaAlert function
dynamic
showPumaAlert(})
Implementation
showPumaAlert(
BuildContext context, {
String title = "",
String message = "",
String yes = "OK",
String? no,
void Function()? onYes,
void Function()? onNo,
Color? yesColor,
Color? noColor,
bool delayYesAction = false,
int delayActionSecond = 5,
}) {
var alert;
Color _yesColor = yesColor ?? Theme.of(context).colorScheme.primary;
Color _noColor = noColor ?? Theme.of(context).colorScheme.error;
if (Platform.isIOS) {
alert = CupertinoAlertDialog(
title: new Text(title),
content: new Text(message),
actions: [
if (no != null)
PumaCupertinoButton(
text: no,
color: _noColor,
onPressed: onNo == null ? () => Navigator.of(context).pop() : onNo,
),
PumaCupertinoButton(
text: yes,
color: _yesColor,
onPressed: onYes!,
delayAction: delayYesAction ? delayActionSecond : 0,
)
],
);
} else {
alert = AlertDialog(
title: Text(title),
content: Text(message),
actions: [
if (no != null)
PumaMaterialButton(
text: no,
color: _noColor,
onPressed: onNo == null ? () => Navigator.of(context).pop() : onNo,
context: context,
),
PumaMaterialButton(
text: yes,
color: _yesColor,
onPressed: onYes!,
delayAction: delayYesAction ? delayActionSecond : 0,
context: context,
),
],
);
}
showDialog(
context: context,
builder: (BuildContext context) {
return alert;
},
);
}