samedi 20 avril 2019

Uncheck other checkbox on checked flutter

I have three checkboxes (lets the user chose different difficulty). Right now the checkboxes are all clickable.

But for obvious reason I only want the user to be able to chose one difficulty at the time- why I'm trying to get every other box unchecked for every new click.

After the user has chosen the difficulty he will be able to make another choice. When that choice is made he will automatically be directed to an other page. (In other words- the checkbox choice is unimportant until the user makes his second choice).

I tried something like

void checkBoxes() {
    if (_value1 = true) {
      _value2 = false;
      _value3 = false;
    } else if (_value2 = true) {
      _value1 = false;
      _value3 = false;
    } else if (_value3 = true) {
      _value1 = false;
      _value2 = false;
    }
  }

But no luck.




Aucun commentaire:

Enregistrer un commentaire