【发布时间】:2021-02-28 16:35:16
【问题描述】:
所以我试图制作两个具有男性和女性价值的单选按钮输入。当我按下单选按钮时,它确实打印了值,但是,单选按钮活动颜色不会改变或保持白色。当我按下单选按钮时,当我按下它时,activecolor 设置为黑色。
Scaffold(
body:Container(
margin:EdgeInsets.fromLTRB(40, 100, 80, 0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Container(
child:Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Radio(
groupValue:genderController.text,
value:"Male",
activeColor: Colors.black,
onChanged:(value){
setState(() {
genderController.text=value;
print(genderController.text);
});
}
),
Text("Male"
,style:TextStyle(fontSize: 10),textAlign: TextAlign.justify,
),
],
)
),
Container(
child:Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Container(
child: Radio(
groupValue:genderController.text,
value:"Female",
activeColor: Colors.black,
onChanged:(value){
setState(() {
genderController.text=value;
print(genderController.text);
});
}
),
),
Text("Female"
,style:TextStyle(fontSize: 10,),textAlign: TextAlign.justify,
),
],
)
),
],
),
));
https://i.stack.imgur.com/3299H.png https://i.stack.imgur.com/G8rWE.png
【问题讨论】:
标签: flutter