0

The PopupMenuButton icon that I'm using is not large enough to receive all taps. I want to use a separate GestureDetector overtop (using a Stack). To do this I create a GlobalKey() and give that key to the PopupMenuButton. Then I can call the PopupMenuButtons methods using the key as 'keyVariableName.currentState.{method()}'. The method I need to access is the onPressed(), but it gives me an error and says that it is not a method. How can I access the onPressed of the PopupMenuButton?

PopupMenuButton(
   key: dotsKey,

var dotsKey = GlobalKey();
dotsKey.currentState.onPressed();

onPressed() is red underlined in the editor.

0 Answers0