我正在制作一个Flutter应用程序,其中使用AlertDialog小部件 这是一个屏幕,您可以在其中了解问题所在:
这是我用于此的代码的一部分
showDialog(
context: context,
builder: (BuildContext context) {
// return object of type Dialog
return AlertDialog(
title: Text('Ajouter un ingrédient'),
content: new Column(
children: <Widget>[
Container(
child: DropDownButtonIngredients(),
),
Container(
child: new TextField(
autofocus: false,
decoration: new InputDecoration(
labelText: 'Nom', hintText: 'Frite, Steak, Salade ...'),
onChanged: (value) {
newIngr = value;
},
)),
],
),
actions: <Widget>[
FlatButton(
child: Text('Ok'),
onPressed: () {
Navigator.of(context).pop();
},
),
],
);
},
);
}
注意:我已经尝试删除DropDownButtonIngredients容器,没有新内容,与其他容器相同
答案 0 :(得分:1)
将mainAxisSize
设置为MainAxisSize.min
:
Column(
mainAxisSize: MainAxisSize.min,
...
);