If I want to make two or more Buttons in a Row to have the same Width, how do I make it? For examples I have three RaisedButtons with different title let say Approve, Reject and Need Revise and if I put the three Buttons in a Row, they will have different Width and I don't want it. What I need is for they have the same Width.
Change width of a row Row normally takes available space and we can control that by wrapping inside a Container or SizedBox widget. You can wrap the Row inside the Container and add width to the container. Then the Row will take the same width as a Container.
You can use a Row wrapping your children with Expanded:
Row( children: <Widget>[ Expanded( child: RaisedButton( child: Text('Approve'), onPressed: () => null, ), ), Expanded( child: RaisedButton( child: Text('Reject'), onPressed: () => null, ), ), Expanded( child: RaisedButton( child: Text('Need Revise'), onPressed: () => null, ), ) ], );
There are two ways:
Double width = MediaQuery.of(context).size.width;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With