how to avoid that a column inside a SnackBar occupies 100% of the height

Viewed 473

I am trying to have 2 rows inside my snackbar and for this I put it inside one column. and the result is that of the gif. How can I make it the default height of the snackbar? I don't want the column to continue to fill the entire screen

enter image description here

SnackBar(
  backgroundColor: _color,
  content: Container(
    child: Column(
        children: <Widget>[
          Row(children: <Widget>[_icon]),
          Row(children: <Widget>[
            SizedBox(width: 10),
          ]),
          Row(children: <Widget>[
            Text(_accion_toast + ". " + mensaje),
          ]),
        ]),
  ),
  duration: Duration(milliseconds: 1500),
);

How can I do it?

3 Answers

You have to mainAxisSize property to reduce size as below.

Column(mainAxisSize: MainAxisSize.min, children: <Widget>[

As I mentioned in comment, by default Column takes up the entire available space, so if you want to restrict it to the minimum, you need to set

Column(
  mainAxisSize: MainAxisSize.min // this property
  children: [],
)
Related