I have a CupertinoAlertDialog and AlertDialog in my Flutter app. every time the dialog pops up, everything behind it becomes darker. I would like to remove the background. how do I do that?
CupertinoDialogAction(
child: Text('Delete',
style: TextStyle(color: Colors.red),
),
onPressed: () async {
await CommentActivity.delete(postData[index]['id'])
.then((response) {
if (response) {
setState(() {
postData.removeAt(index);
createPageActivity();
renderPageActivity();
});
Navigator.of(context).pop();
}
});
}
)
],
)
Just launch the dialog with de navigator instead of using the showDialog() and use a PageRouteBuilder
Navigator.of(context).push(
PageRouteBuilder(
pageBuilder: (context, _, __) => AlertDialog(),
opaque: false),
);