دوست عزیزی که پرسیده بودن دیالوگ نشون بدیم قبل از حذف این نمونه کد هستش میتونید از این استفاده کنیدومتد showAlertDialog رو در onLongPress استفاده کنید
showAlertDialog(BuildContext context, TaskEntitiy task) {
// set up the buttons
Widget yesButton = TextButton(
child: Text("Yes"),
onPressed: () {
task.delete();
Navigator.pop(context);
},
);
Widget noButton = TextButton(
child: Text("No"),
onPressed: () {
Navigator.pop(context);
},
);
// set up the AlertDialog
AlertDialog alert = AlertDialog(
title: Text("Alert"),
content: Text("Would you like to delete this item?"),
actions: [
yesButton,
noButton,
],
);
// show the dialog
showDialog(
context: context,
builder: (BuildContext context) {
return alert;
},
);
}