I have a Column
widget with two TextField
widgets as children and I want to have some space between both of them.
I already tried mainAxi
There are many ways of doing it, I'm listing a few here.
Use Container
and give some height:
Column(
children: [
Widget1(),
Container(height: 10), // set height
Widget2(),
],
)
Use Spacer
Column(
children: [
Widget1(),
Spacer(), // use Spacer
Widget2(),
],
)
Use Expanded
Column(
children: [
Widget1(),
Expanded(child: SizedBox()), // use Expanded
Widget2(),
],
)
Use mainAxisAlignment
Column(
mainAxisAlignment: MainAxisAlignment.spaceAround, // mainAxisAlignment
children: [
Widget1(),
Widget2(),
],
)
Use Wrap
Wrap(
direction: Axis.vertical, // make sure to set this
spacing: 20, // set your spacing
children: [
Widget1(),
Widget2(),
],
)