Aymeric Le Feyer
Aymeric Le Feyer

Reputation: 376

Column take all the screen

I'm making a flutter app in which I use an AlertDialog widget Here is a screen in which you can understand where the problem is :

screenshot

Here is a piece of my code used for that

    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();
              },
            ),
          ],
        );
      },
    );
  } 

Note : I already tried to remove the DropDownButtonIngredients container, nothing new, same for the other container

Upvotes: 0

Views: 126

Answers (1)

R&#233;mi Rousselet
R&#233;mi Rousselet

Reputation: 277717

Set mainAxisSize to MainAxisSize.min:

Column(
  mainAxisSize: MainAxisSize.min,
  ...
);

Upvotes: 1

Related Questions