سلام
من از alert dialog استفاده کردم که موقع اجرا وقتی روی دکمه yes یا میزنم موقع اجرای دستور Navigator.of(context).pop(); خطا میده
لطفا کدتون رو بفرستید
showAlertDialog(BuildContext context) {
// set up the buttons
Widget yesButton = TextButton(
child: Text("بلی"),
onPressed: () {
//task.delete();
Navigator.of(context).pop();
},
);
Widget noButton = TextButton(
child: Text("خیر"),
// set up the AlertDialog
AlertDialog alert = AlertDialog(
title: Text(""),
content: Text("آیا کار حذف شود؟"),
actions: [
yesButton,
noButton,
],
// show the dialog
showDialog(
context: context,
builder: (BuildContext context) {
return alert;
}
و نحوه استفاده
showAlertDialog(context);
من از کدتون در قسمت onLongPress استفاده کردم، مشکلی نداشت. احتمالا جای مناسبی فراخوانی نمیکنید که به ارور میخورید.