title: Flutter showDialog with loading spinner and confirmation
body: <p>In flutter, I have a showDialog() with cancel and confirm button. The confirm button will trigger a call to an API. What I need is to show a "loading..." in the showDialog window after the click and once the API call is finished to show a success or failure. How can I manage this? Or should I close the window, waiting for the reply and popup a new dialog window with success or false? Thx for any help or better suggestion. Here what I have so far:</p>
  
  <pre><code>void _showAlert(String textLabel, String action, String linkId) {
    showDialog(
      context: context,
      //barrierDismissible: false, // on external click
      builder: (_) =&gt; new AlertDialog(
        shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10.0)),
        title: new Text(
          'Please confirm:',
          style: TextStyle(color: Colors.deepOrange, fontWeight: FontWeight.bold),
          textAlign: TextAlign.center,
        ),
        content: new Text(
          textLabel,
          style: new TextStyle(fontSize: 20.0),
        ),
        actions: &lt;Widget&gt;[
          new FlatButton(
              onPressed: () {
                Navigator.pop(context);
              },
              child: new Text('CANCEL')),
          new FlatButton(
              onPressed: () {
                _postAction(action, linkId).then((_) =&gt; setState(() {}));
                Navigator.pop(context);
              },
              child: new Text('I CONFIRM')),
        ],
      ));
  }
  </code></pre>