Skip to content

Instantly share code, notes, and snippets.

@hasanzia1993
Created March 29, 2020 18:41
Show Gist options
  • Save hasanzia1993/ca8d65ee508275a88ee4e9e62768ae75 to your computer and use it in GitHub Desktop.
Save hasanzia1993/ca8d65ee508275a88ee4e9e62768ae75 to your computer and use it in GitHub Desktop.
To show popupmenu without using PopupMenuButton since it only works with onTap.
showCustomMenu(context) {
final RenderBox overlay = Overlay.of(context).context.findRenderObject();
showMenu(
context: context,
position: RelativeRect.fromRect(
_tapPosition & Size(40, 40),
Offset.zero & overlay.size
),
items: [
PopupMenuItem(
child: Text('Copy'),
),
PopupMenuItem(
child: Text('Reply'),
),
],
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment