Row Column alignment

Viewed 38

I'm trying to align Widgets inside Rows. Those Rows are children of a Column. I can't align the Widgets with "MainAxisAlignment.spaceBetween". Any ideas of how to do proper alignment?

2 Answers

Add a bound as first step to which the widget should span

SizedBox(
 height: MediaQuery.of(context).size.height,
 width: MediaQuery.of(context).size.width,
 child: Column(
  children : [
   Row(
    mainAxisAlignment: MainAxisAlignment.spaceBetween,
    children: [
      Container(height: 20, width:20, color:Colors.red),
      Container(height: 20, width:20, color:Colors.red),
    ]
   )
  ]
 )
);

preview

Try mainAxisAlignment.spaceEvenly property.

Related