onOpen property
final
Called when the menu overlay is shown.
When MenuController.open is called, onOpenRequested is invoked with a
showOverlay
callback that, when called, shows the menu overlay and
triggers onOpen.
The default implementation of onOpenRequested calls showOverlay
synchronously, thereby calling onOpen synchronously. In this case,
onOpen is called regardless of whether the menu overlay is already
showing.
Custom implementations of onOpenRequested can delay the call to
showOverlay
, or not call it at all, in which case onOpen will not be
called. Calling showOverlay
after disposal is a no-op, and will not
trigger onOpen.
A typical usage is to respond when the menu first becomes interactive, such as by setting focus to a menu item.
Implementation
final VoidCallback? onOpen;