Reputation: 2821
In iOS's native AutoLayout constraints, It very easy to make a equal width constraints between ViewA and ViewB . And these two views will get a same width always.
But in flutter ,it seems can't be achived this kindof constraints so easily?
Do I have to make a SizedBox with specific width for both WidgetA and WidgetB explicitly?
Upvotes: 0
Views: 1447
Reputation: 1456
You can always put your widgets in a Row()
, and wrap every widget in Expanded()
. This way they will always have 50% width of the parent Row()
. And if you need to constrain the width, just wrap the Row()
in a SizedBox()
.
SizedBox(
width: 500.0,
child: Row(
children: [
Expanded(
child: Container(),
),
Expanded(
child: Container(),
),
],
),
),
Upvotes: 2