title: How can I remove the overlayEntry when I click outside in Flutter?
body: <p>I want to have a function like popupwindow in Android . </p>
  
  <p>And I have tried for this .</p>
  
  <pre class="lang-dart prettyprint-override"><code>class CommunityMenu {
    static OverlayEntry overlayEntry;
  
    static void showMenu(BuildContext context) {
      if (overlayEntry == null) {
        overlayEntry = new OverlayEntry(builder: (context) {
          return Positioned(
            right: 12,
            top: 60,
            child: Container(
              color: Colors.white,
              width: 132,
              height: 153,
              child: Column(
                mainAxisAlignment: MainAxisAlignment.spaceAround,
                children: &lt;Widget&gt;[
                  GestureDetector(
                    onTap: (){
                      overlayEntry.remove();
                    },
                    child: Row(
                      children: &lt;Widget&gt;[
                        Text(
                          "Text1",
                          style: TextStyle(
                              color: Color(0xff4d4d4d), fontSize: 14),
                        )
                      ],
                    ),
                  ),
                  GestureDetector(
                    onTap: () {overlayEntry.remove();
                    },
                    child: Row(
                      children: &lt;Widget&gt;[
                        GestureDetector(
                          onTap: (){
                            overlayEntry.remove();
                          },
                          child: Text(
                            "Text2",
                            style: TextStyle(
                                color: Color(0xff4d4d4d), fontSize: 14),
                          )
                        )
                      ],
                    ),
                  ),
                  GestureDetector(
                    onTap: (){
                      overlayEntry.remove();
                    },
                    child: Row(
                      children: &lt;Widget&gt;[
                        Text(
                          "Text3",
                          style: TextStyle(
                              color: Color(0xff4d4d4d), fontSize: 14),
                        )
                      ],
                    ),
                  )
                ],
              ),
            ),
          );
        });
      }
  
      Overlay.of(context).insert(overlayEntry);
    }
  
    static void dismissMenu() {
      if (overlayEntry != null) {
        overlayEntry.remove();
        overlayEntry = null;
      }
    }
  }
  </code></pre>
  
  <p>You can see that when I click the menu item , I can dismiss the menu ( overlayEntry.remove();) . 
  The problem is now I want to dismiss the menu when I click outside not inside the menu . It Looks like dismiss the keyboard when click outside .</p>