I have a bottom list modal in flutter that I want to use as a way to add and remove tags. I am using filter chips as the way to toggle from a pre-built list of tags.
I have the bottom sheet modal working great, pops up on icon button click. The filter chips show in the modal but nothing happens when I tap them... But if I close the bottom sheet modal then re-open it they they look selected...
IconButton(
icon: const Icon(Icons.add_circle),
color: const Color(0xFF20647A),
//show tags sheeet
onPressed: () {
showModalBottomSheet<void>(
context: context,
builder: (BuildContext context) {
return SizedBox(
height: MediaQuery.of(context).size.height * 0.58,
width: MediaQuery.of(context).size.width,
child:
//bottom sheet body
Column(
mainAxisAlignment: MainAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
ElevatedButton(
child: const Text('Close BottomSheet'),
onPressed: () => Navigator.pop(context),
),
const SizedBox(height: 16),
Wrap(
spacing: 10,
children: tagListFull.map(
(category) {
return FilterChip(
selected:
selectedTags.contains(category),
onSelected: (bool selected) {
if (selected) {
selectedTags.add(category);
} else {
selectedTags.remove(category);
}
},
label: Text(category),
);
},
).toList(),
),
],
),
);
},
);
},
),
My initial gut was that it was a setState issue, but when I added set state to the add(category) and remove(category) then taping them didnt work at all even when closing and re-openning the bottom sheet modal.