Я новичок здесь, и у меня проблема с alerttdialog.Тип У меня есть alerttdialog, который имеет кнопку выбора цвета и уже поставляется с предустановленным цветом, эта кнопка приводит к другому alerttdialog, который делает выбор цвета.После выбора этого нового цвета возвращается к первому алерту и появляется кнопка с новым цветом, но этого не происходит.Большое спасибо.И не называйте английский, потому что я использую переводчик.
Future<Color> 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: <Widget>[
FlatButton(
child: Text('OK'),
onPressed: (){
Navigator.pop(context,selectedColor);
},
)
],
);
}
);
}
Future<List> 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: <Widget>[
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: <Widget>[
FlatButton(
child: Text('CANCELAR'),
onPressed: (){
Navigator.pop(context, null);
},
),
FlatButton(
child: Text('OK'),
onPressed: (){
//print('cor '+selectedColor.toString());
Navigator.pop(context,[name,selectedColor]);
},
)
],
);
}
);}