I have a row with two component in as Card as follows:
Card(child:Row(
mainAxisAlignment: MainAxisAlignment.center,
children:[
Text("Col 1"),
SizedBox(width: 10),
Text("Col 2"),
])
)
Though the whole row content is horizontally centered in the screen, it expands the whole width where I’d like it to shrink to the space it really needs.
How to do that?
2
Answers
Using the Expanded widget seems like your best bet, as it will shrink the row whilst ensuring that it’s aligned in the center.
Simply add
to the
Row
. So like