Reputation:
I am using below Row
widget in flutter , which is nested in a Column
widget and on screen it appears shared in the screenshot
I want to the Row elements to appear at extreme ends with some padding. How can I do that?
Row(
children: [
SizedBox(width:20,),
Text("Mark ALL READ"),
SizedBox(width:200,),
Text("Clear All"),
],
),
Upvotes: 3
Views: 1346
Reputation: 1018
Okk this one you can do with below code. You need to wrap Row in Padding and use mainAxisALignment on Row.
Padding(
padding: EdgeInsets.all(8),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
SizedBox(
width: 20,
),
Text("Mark ALL READ"),
SizedBox(
width: 200,
),
Text("Clear All"),
],
),
),
Upvotes: 0
Reputation: 702
Setting the mainAxisAlignment
property of the row to MainAxisAlignment.spaceAround
should place the elements on both ends of the row.
To add some padding you should be able to just place the whole Row()
widget into a Padding()
widget.
Upvotes: 2