title: Using Form in Alertdialog
body: <p>I want to create an object in body and use it in alertdialog, how should I do it? For example:</p>
  <pre><code>var form = Form(
  );
  ********
  return AlertDialog(
  content: form,
  ),
  </code></pre>
  <p>The reason I want to do this is because when I try to use the buildForm structure outside the body it doesn't work. But I can't define it in the body because I want to use floating action button how can I solve it or is there a different way to solve it?</p>
  <p><a href="https://i.stack.imgur.com/OaEVQ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/OaEVQ.png" alt="enter image description here" /></a></p>
  <pre><code>   floatingActionButton: FloatingActionButton(
      child: Icon(Icons.add),
      tooltip: &quot;New ToDo&quot;,
      onPressed: () {
        showDialog(
          context: context,
          builder: (BuildContext context) {
            return AlertDialog(
              title: Text(&quot;New ToDo&quot;),
              content: Container(
                child: Column(children: [
                  Form(
                    key: _formKey,
                    child: Column(children: [
                      buildForm(_controllerTitle, &quot;Title&quot;)
                    ],),
                  ),
                ],),
              ),
              actions: [
              ],
            );
          },
        );
      },
    ),              
  </code></pre>