Flutter : Vertically center column

With Column, use:

mainAxisAlignment: MainAxisAlignment.center

It align its children(s) to center of its parent Space vertically


Solution as proposed by Aziz would be:

Column(
  mainAxisAlignment: MainAxisAlignment.center,
  crossAxisAlignment: CrossAxisAlignment.center,
  children: [
    //your widgets here...
  ],
)

It would not be in the exact center because of padding:

padding: EdgeInsets.all(25.0),

To make exactly center Column - at least in this case - you would need to remove padding.


Try:

Column(
 mainAxisAlignment: MainAxisAlignment.center,
 crossAxisAlignment: CrossAxisAlignment.center,
 children:children...)

Tags:

Flutter