title: Flutter - Custom back button doesn't work
body: <p>I have an <code>alertdialog</code> which is supposed to return a bool depending on the user's choice, the message gets removed, but the back button isn't working!</p>
  <pre><code> Future&lt;bool?&gt; showwarning(BuildContext context) async {
      showDialog&lt;bool&gt;(
          context: context,
          builder: (context) =&gt; AlertDialog(
                title: new Text(&quot;Alert!!&quot;),
                content: new Text(&quot;Return To Main Page?!&quot;),
                actions: [
                  TextButton(
                    child: new Text(&quot;Yes&quot;),
                    onPressed: () {
                      Navigator.pop(context, true);
                    },
                  ),
                  TextButton(
                    child: new Text(&quot;Nope&quot;),
                    onPressed: () {
                      Navigator.pop(context, false);
                    },
                  )
                ],
              ));
    }
  Widget build(BuildContext context) {
      // TODO: implement build
  
      return WillPopScope(
          onWillPop: () async {
            final user_decision = await showwarning(context);
            return user_decision ?? false;
          },
  </code></pre>