Can someone explain to me why would this happened?
I would like to display the check
status based on the value returned from FutureBuilder
.
If snapshot.data
is 1, it will display checkbox
with checked status. Otherwise will allow user to tick.
I have 6 check boxes, the first 3 check boxes is checked, the others no. But it only display the last 3 check boxes. The checkbox with checked
status not going to show.
...item['questions'].asMap().entries.map((items) {
return TableRow(children: [
Padding(
padding: EdgeInsets.all(10),
child: Text(items.value['name'])),
FutureBuilder(
future: _workOrderBloc.selectAnswer(
items.value['id'], "MC"),
builder: (context, snapshot) {
return Checkbox(
tristate: true,
onChanged: snapshot.data == "1"
? null
: (answer) {
},
value: snapshot.data == "1"
? true
: answers[items.value['id']] ?? false);
}),
]);
}).toList()
But after reload, the check box with check status will show. How to make it show before reload?
Aucun commentaire:
Enregistrer un commentaire