提问人:NecSil 提问时间:11/13/2023 最后编辑:NecSil 更新时间:11/13/2023 访问量:21
从RadioListTile中选择一个选项后,我只想保留文本标题
After i chose an option from a RadioListTile i want to keep just the text title
问:
在此处输入图像描述我希望在我从广播列表中选择一个项目后,只保留广播列表的标题并制作 ckeckbox,如果我可以这样命名的话,消失。 你对我该怎么做有什么想法吗?非常感谢,祝你有美好的一天! 到目前为止,这是我的代码示例:
Column(
children: [
RadioListTile(
fillColor: MaterialStateProperty.resolveWith<Color>(
(Set<MaterialState> states) {
return CustomColors.primary;
}),
title: Text(
'Option 1',
style: TextStyle(
color:
selectedRadioGroup1 == 1 ? CustomColors.primary : null),
),
value: 1,
groupValue: selectedRadioGroup1,
onChanged: (value) {
setState(() {
selectedRadioGroup1 = value;
nestedSelectedRadioGroup1 = null; // Reset nested selection
});
},
),
if (selectedRadioGroup1 == 1)
Padding(
padding: const EdgeInsets.only(left: 15.0),
child: Column(
children: [
RadioListTile(
title: const Text('Nested Option A'),
value: 3,
groupValue: nestedSelectedRadioGroup1,
onChanged: (value) {
setState(() {
nestedSelectedRadioGroup1 = value;
});
},
),
RadioListTile(
title: const Text('Nested Option B'),
value: 4,
groupValue: nestedSelectedRadioGroup1,
onChanged: (value) {
setState(() {
nestedSelectedRadioGroup1 = value;
});
},
),
],
),
),
],
),
答: 暂无答案
评论