showCupertinoAlert static method
dynamic
showCupertinoAlert(
- BuildContext context, {
- String title = "提示",
- String? detailTitle,
- dynamic trueFunction()?,
- dynamic cancelFunction()?,
Implementation
static showCupertinoAlert(BuildContext context,
{String title = "提示",
String? detailTitle,
Function()? trueFunction,
Function()? cancelFunction}) {
return showCupertinoDialog(
context: context,
builder: (context) {
return CupertinoAlertDialog(
title: Text(title),
content: detailTitle != null ? Text(detailTitle) : null,
actions: cancelFunction != null
? [
CupertinoDialogAction(
child: Text('确认'),
onPressed: () {
if (trueFunction != null) trueFunction();
},
),
CupertinoDialogAction(
child: Text('取消'),
isDestructiveAction: true,
onPressed: () {
if (cancelFunction != null) cancelFunction();
},
),
]
: [
CupertinoDialogAction(
child: Text('确认'),
onPressed: () {
if (trueFunction != null) trueFunction();
},
),
],
);
});
}