我想在ListTile的字幕上水平显示2个单选按钮。 我只能看到一个单选按钮。
List<QuestionsOptions> optionsList = [
QuestionsOptions(
index: 1,
name: "Yes",
),
QuestionsOptions(
index: 0,
name: "No",
),
];
subtitle:Column(
children: [
new Row(
children: <Widget>[
Expanded(
child: Container(
child: Column(
children:
optionsList.map((data) => RadioListTile(
title: Text("${data.name}"),
groupValue: 0,
value: data.index,
onChanged: (val) {
//_handleWeightChange(data.name,data.index);
},
)).toList(),
),
)),
],
),
]),
如何在Listtile字幕中水平显示两个单选按钮
答案 0 :(得分:1)
请在Row Widget
RadioListTile(
groupValue: selectedRadioList[index]==""?0:
selectedRadioList[index]=="0"?false:true,
title: Text('First'),
value: true,
onChanged: (val) {
setState(() {
selectedRadioList[index] = "1";
});
},
),
RadioListTile(
groupValue: selectedRadioList[index]==""?0:
selectedRadioList[index]=="0"?false:true,
title: Text('Second'),
value: false,
onChanged: (val) {
setState(() {
selectedRadioList[index] = "0";
});
},
),