在flutter中,如何设置单个单选按钮默认选中,如下图所示?
我想要的
,
我得到的
Center(
child: Row(
children: [
Padding(
padding: const EdgeInsets.only(left: 30, top: 10),
child: SizedBox(
width: 150, // <-- match_parent
height: 45,
child: RadioListTile(
title: Padding(
padding: const EdgeInsets.only(left: 0),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
///use your image
Text(
" English",
style: TextStyle(
color: Color(0xff000000),
fontWeight: FontWeight.bold,
),
),
],
),
),
value: "English",
groupValue: "english",
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(5)),
onChanged: (value) {
setState(() {});
},
tileColor: Color(0xff28e8df),
),
),
1条答案
按热度按时间w41d8nur1#
您可以将
value
和groupValue
设置为相同。或