Open hosseinvejdani opened 1 year ago
But it works fine with opTap property of ListTile inside a PopupMenuItem:
PopupMenuItem(
child: ListTile(
onTap: () => showOnDeletePlaceDialog(),
trailing: Icon(
Icons.delete_outline,
size: 35.r,
color: Theme.of(context).colorScheme.primary,
),
title: Text(
'حذف مکان',
style: Theme.of(context).textTheme.bodySmall?.copyWith(
color: Theme.of(context).colorScheme.onBackground,
),
),
),
),
@hosseinvejdani Open dialog from onSelected method given inside PopupMenuButton instead of onTap. also remove Get.back();
from showOnDeletePlaceDialog
PopupMenuButton(
onSelected: (int value) {
if (value == 1) {
showOnDeletePlaceDialog();
}
},
itemBuilder: (context) {
return [
PopupMenuItem(
value: 1,
child: Row(
children: [
Icon(
Icons.delete_outline,
size: 35.r,
color: Theme.of(context).colorScheme.primary,
),
SizedBox(width: 15.w),
Text(
'حذف مکان',
style: Theme.of(context).textTheme.bodySmall?.copyWith(
color: Theme.of(context).colorScheme.onBackground,
),
),
],
),
),
];
},
);
void showOnDeletePlaceDialog() {
Get.put(DeletePlaceDialogController());
Get.generalDialog(
pageBuilder: (context, animation, secondaryAnimation) {
return AlertDialog(
backgroundColor: Get.theme.colorScheme.background.lighten(),
title: _title(context),
content: _content(context),
);
},
);
}
Describe the bug Get.generalDialog() does not work inside PopupMenuButton. when i try to lunch a generalDialog using onTap property of PopupMenuItem inside PopupMenuButton on AppBar, nothing happens.
Reproduction code
example:
Tis message appears when i tap item:
Expected behavior I expected that i see an AlertDialog
Flutter Version: Flutter 3.7.5 • channel stable
Getx Version: get: ^4.6.5
Describe on which device you found the bug: Android.