lundi 13 novembre 2023

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

enter image description hereI want after i chose an item from a radio list, to keep just the title of radio list and make the ckeckbox, if i can name it like that, dissapear. Do you have any idea on how can i do that? Thanks a lot and have a nice day! This is a sample of my code so far:

  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;
                    });
                  },
                ),
              ],
            ),
          ),
      ],
    ),



Aucun commentaire:

Enregistrer un commentaire