closeJoyDropDown function

void closeJoyDropDown(
  1. BuildContext context
)

Function to remove any overlay or dropdown that is on the screen. This function is useful if you want to close the menu when clicking on an item.

Example:

InkWell(onTap: () {
  closeJoyDropDown(context);
  // Make a navigation, maybe..
 },
);

Implementation

void closeJoyDropDown(BuildContext context) {
  if (overlayEntry != null) {
    closeTimer = Timer(const Duration(milliseconds: 100), () {
      isMenuShowing = false;
      overlayEntry?.remove();
      overlayEntry = null;
      closeTimer = null;
      //canCloseMenu = true;
    });
  }
}