here you can see what I currently have:(目前不允许我插入此图片)。我在ListView中有两个带有两个单选按钮的TabBar,但是看起来很糟糕。我想将单选按钮一个放在另一个的下面,而不考虑字符串的长度。
这是我的代码:
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: () {},
),
如何正确对齐单选按钮?
您可以在每个Spacer(),
小部件之间使用Container(),
小部件并对其进行调整。