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
You can also use a helper function to add spacing after each child.
List childrenWithSpacing({
@required List children,
double spacing = 8,
}) {
final space = Container(width: spacing, height: spacing);
return children.expand((widget) => [widget, space]).toList();
}
So then, the returned list may be used as a children of a column
Column(
children: childrenWithSpacing(
spacing: 14,
children: [
Text('This becomes a text with an adjacent spacing'),
if (true == true) Text('Also, makes it easy to add conditional widgets'),
],
),
);
I'm not sure though if it's wrong or have a performance penalty to run the children through a helper function for the same goal?