Checkbox(
checkColor: Colors.red,
activeColor: Colors.white,
onChanged: (bool value) {
dataOfArray.add(arrayOfId);
var n = dataOfArray.indexOf(arrayOfId);
print("data$n ---OfArray${dataOfArray}---${[arrayOfId]}");
setState(() {
// if (_checkboxval) {
// setState(() {
// _checkboxval = false;
// });
// }else {
// setState(() {
// _checkboxval = true;
// });
// }
if (
//dataOfArray[n]== arrayOfId
dataOfArray.indexOf(arrayOfId) != -1) {
this._checkboxval = value;
print("dataOf///////////Array$dataOfArray");
}
// else this._checkboxval=value;
});
},
//value: arrayOfId[''],
value: this._checkboxval,
);
Here I am trying to select a single check bocx into the default listview builder.
But it is selecting all the checkbox into the created listview builder. please help if you have faced this type of error.
In that i take an dynamic listview of data using firebase in that particular list i give the data with checkbox and on particular checkbox all checkbox are selected.
Aucun commentaire:
Enregistrer un commentaire