I'm trying to use CupertinoAlertDialog
on my profile page. It works just fine on my other page, but not the profile page.
Here is my code:
showCupertinoModalPopup(
context: context,
builder: (context) => CupertinoActionSheet(
actions: [
image != null ? CupertinoActionSheetAction(
child: Text('Remove photo',
style: TextStyle(
color: Colors.red
),),
onPressed: () {
Navigator.pop(context);
_openDialog(context);
},
)
void _openDialog(ctx) {
showCupertinoDialog(
context: ctx,
builder: (_) => CupertinoAlertDialog(
title: Text("Delete Chat"),
content: Text("Messages will be removed from this device only."),
actions: [
// Close the dialog
// You can use the CupertinoDialogAction widget instead
CupertinoButton(
child: Text('Cancel',
style: TextStyle(
color: Color(0xFF2481CF)
),
),
onPressed: () {
Navigator.of(ctx).pop();
}),
CupertinoButton(
child: Text('Delete',
style: TextStyle(
color: Colors.red
),
),
onPressed: () {
Navigator.of(ctx).pop();
},
)
],
));
}
And this is the error:
Is there any solutions?