dimanche 3 mai 2020

Checkbox with many options

I created two checkboxes but after clicking on one of them both are marked, as in the picture below, could someone help me solve this problem?

only one can be marked,

enter image description here

my code:

  _buildLanguagesList() {
    return ListView.builder(
      itemCount: languagesList.length,
      itemBuilder: (context, index) {
        return _buildLanguageItem(languagesList[index]);
      },
    );
  }

   bool _value = false;
  _buildLanguageItem(String language) {
    return CheckboxListTile(
      title: Text(language),
      value: _value,
      onChanged: (value) {
        setState(() {
          _value = value;
          application.onLocaleChanged(Locale(languagesMap[language]));
        });
      },
      controlAffinity: ListTileControlAffinity.trailing,
    );
  }

thanks for any help :)




Aucun commentaire:

Enregistrer un commentaire