Reputation: 1419
here you can see what I currently have: (I'm currently not allowed to insert this picture). I have two TabBars with two Radio Buttons each in a ListView, but it looks horrible. I would like to place the radio buttons one below the other, regardless of the length of the strings.
Here is my code:
return ListView(
children: <Widget>[
//..
),
Container(
child: ButtonBar(
alignment: MainAxisAlignment.spaceBetween, // I also tried every other setting here, but none works for me
children: <Widget>[
Radio(
value: 1,
groupValue: _selectedRadio,
activeColor: corpColorPrimary,
onChanged: (val) => setSelectedRadio(val),
),
Text("a long String"),
Radio(
value: 2,
groupValue: _selectedRadio,
activeColor: corpColorPrimary,
onChanged: (val) => setSelectedRadio(val),
),
Text("Another long String"),
],
)),
Container(
child: ButtonBar(
alignment: MainAxisAlignment.start,
children: <Widget>[
Radio(
value: 1,
groupValue: _selectedRadio,
activeColor: corpColorPrimary,
onChanged: (val) => setSelectedRadio(val),
),
Text("Hi"),
Radio(
value: 2,
groupValue: _selectedRadio,
activeColor: corpColorPrimary,
onChanged: (val) => setSelectedRadio(val),
),
Text(":)"),
],
),
),
RaisedButton(
child: Text("Next"),
onPressed: () {},
),
How can I align the Radio buttons correctly?
Upvotes: 0
Views: 569
Reputation: 327
Take Row and in Row take two columns that will solve your issue.
Upvotes: 0
Reputation: 180
you can use Spacer(),
widget between each Container(),
widget and adjust them.
Upvotes: 0