flutter align column center code example

Example 1: flutter column center horizontal text

Center(
          child: Column(
            mainAxisSize: MainAxisSize.max,
            mainAxisAlignment: MainAxisAlignment.center,
            children: <Widget>[
              Text('You are at center!'),
            ],
          ),
        ),

Example 2: flutter column widget vertical center

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

Example 3: flutter column align

Row(  crossAxisAlignment: CrossAxisAlignment.start,  verticalDirection: VerticalDirection.down,  children: [    Text(      'Flutter',      style: TextStyle(        color: Colors.yellow,        fontSize: 30.0      ),    ),    Text(      'Flutter',      style: TextStyle(          color: Colors.blue,          fontSize: 20.0      ),    ),  ],);

Example 4: align column to center of flex flutter

// If you want the whole table to be Centered, use the mainAxisAlignment property of Column.
///Column
mainAxisAlignment: MainAxisAlignment.center //Center Column contents vertically,
crossAxisAlignment: CrossAxisAlignment.center //Center Column contents horizontally,

///Row
mainAxisAlignment: MainAxisAlignment.center //Center Row contents horizontally,
crossAxisAlignment: CrossAxisAlignment.center //Center Row contents vertically,

Tags:

Dart Example