从RadioListTile中选择一个选项后,我只想保留文本标题

After i chose an option from a RadioListTile i want to keep just the text title

提问人:NecSil 提问时间:11/13/2023 最后编辑:NecSil 更新时间:11/13/2023 访问量:21

问:

在此处输入图像描述我希望在我从广播列表中选择一个项目后,只保留广播列表的标题并制作 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;
                    });
                  },
                ),
              ],
            ),
          ),
      ],
    ),
Flutter 复选框 单选按钮

评论

0赞 tomerpacific 11/13/2023
你能分享你想做什么的图像或模拟吗?描述不是很清楚。
0赞 NecSil 11/13/2023
我在描述中分享了一个img

答: 暂无答案