Shrink container to smaller child rather than expanding to fill parent
wrapping a Container in a Row() widget makes the container shrinks to the Container's child size as mentioned here,, https://github.com/flutter/flutter/issues/4949
Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
child:button()
),
]
),
To get the container not to take up the entire parent, you need to tell it where it should be placed within the parent - by default, it doesn't know where to go so it fills the parent =D.
The simplest ways of doing this are to use an Align
or a Center
widget. I believe you want to put it around your Container
in this case, but I'm not 100% sure.