I need your help. I'm making a DropdownButton
and I'm facing the following problem - I can't see the items that are selected in the DropdownMenuItems
. I do not understand what the problem is that nothing is displayed. I'm using the
CodePudding user response:
While the UI is need to update on DropdownMenuItem
you can wrap GFCheckboxListTile
with StatefulBuilder
.
child: Container(
child: StatefulBuilder(
builder: (context, setStateSB) => GFCheckboxListTile(
value: _selectedTitles.contains(widget.items[index]),
onChanged: (bool selected) {
_onItemSelect(selected, index);
setStateSB(() {}); /// we are using StatefulBuilder's setState
///add your logic then
setState(() {
selectedValue = widget.items[index];
});
},
DropdownMenuItem
ontap is outSide the GFCheckboxListTile
therefore onChanged
is not calling. I am using onChanged
from GFCheckboxListTile
to update the selectedValue
.