在这个项目中,我有10个问题,每个问题有4个选项。每个选项都溢出(抖动:引发了另一个异常:RenderFlex在右侧196像素处溢出。 )。请参阅下面的“我的代码”
//using RadioButtonGroup because question have 4 option
RadioButtonGroup(
labels: <String>[
que_list[index]['option_list'][0],
que_list[index]['option_list'][1],
que_list[index]['option_list'][2],
que_list[index]['option_list'][3]
],
labelStyle: TextStyle(
fontSize: 15,
fontWeight: FontWeight.normal,
color: Colors.white
),
onChange: (String label, int index) {},
onSelected: (String selected) {
print(selected);
},
activeColor: Colors.white,
),
我尝试了上面的代码,还将Column和Container赋予了RadioButtonGroup
,但是没有发生任何变化。谁能帮我解决这个问题?
谢谢
答案 0 :(得分:1)
也许这会帮助您:
return Scaffold(
appBar: AppBar(
title: Text('First Route'),
),
body: Center(
child: Container(
color: Colors.blue,
child: RadioButtonGroup(
labels: <String>[
"que_list[index]['option_list'][0] que_list[index]['option_list'][0]",
"que_list[index]['option_list'][1]",
"que_list[index]['option_list'][2]",
"que_list[index]['option_list'][3]"
],
labelStyle: TextStyle(
fontSize: 15,
fontWeight: FontWeight.normal,
color: Colors.white),
onChange: (String label, int index) {},
onSelected: (String selected) {
print(selected);
},
activeColor: Colors.white,
itemBuilder: (Radio radioButton, Text label, int index) {
return Row(children: [radioButton, Flexible(child: label)]);
}
)),
));