title: How to update button color variable in alertDialog?
body: <p>I'm new here and I'm having a problem with the alertdialog.
  Type I have an alertdialog that has a select color button and that already comes with a pre set color, this button leads to another alertdialog that makes the color selection. After selecting this new color, returns to the first alertdialog and the button should come with the new color, but this does not happen.
  Thank you very much. And do not call English, because I'm using a translator.</p>
  
  <pre><code>Future&lt;Color&gt; selectColor(BuildContext context, Color currentColor){
    Color selectedColor = currentColor;
    return showDialog(
      context: context,
      builder: (BuildContext context){
        return AlertDialog(
          title: Text('Selecionar Cor'),
          content: SingleChildScrollView(
            child: BlockPicker(
              pickerColor: currentColor,
              onColorChanged: (Color color){
                selectedColor = color;
              },
            ),
          ),
          actions: &lt;Widget&gt;[
  
              FlatButton(
                child: Text('OK'),
                onPressed: (){
                  Navigator.pop(context,selectedColor);
                },
              )
            ],
  
        );
      }
    );
  }
  
  Future&lt;List&gt; createCategory(BuildContext context) async{
  
    String name = '';
    Color selectedColor = BLUE;
  
    return showDialog(
        context: context,
        builder: (BuildContext context){
          return AlertDialog(
            title: Text('Nova Categoria'),
            content: Row(
              children: &lt;Widget&gt;[
                Flexible(
                    flex: 4,
                    child:
                    TextField(
                      maxLength: 30,
                      decoration: InputDecoration(
                          labelText: 'Nome'
                      ),
                      onChanged: (String value){
                        name = value;
                      },
                    )
                ),
  
                Padding(
                  padding: EdgeInsets.symmetric(horizontal: 3),
                ),
  
                Flexible(
                    flex: 1,
                    child:
                    RaisedButton(
                        color: selectedColor,
                        onPressed: () async{
  
                          selectedColor = await selectColor(context, selectedColor);
  
                        }
                    )
                )
              ],
            ),
  
            actions: &lt;Widget&gt;[
              FlatButton(
                child: Text('CANCELAR'),
                onPressed: (){
                  Navigator.pop(context, null);
                },
              ),
  
              FlatButton(
                child: Text('OK'),
                onPressed: (){
                  //print('cor '+selectedColor.toString());
                  Navigator.pop(context,[name,selectedColor]);
                },
              )
            ],
          );
        }
    );}
  </code></pre>