Created
March 29, 2020 18:41
-
-
Save hasanzia1993/ca8d65ee508275a88ee4e9e62768ae75 to your computer and use it in GitHub Desktop.
To show popupmenu without using PopupMenuButton since it only works with onTap.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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