Closed Giacomo-Cattani closed 2 months ago
I am posting here after some days of testing. Continuing to test, I found a possible fix. I modified validateRemoveItem
by casting the returned list, and it seems to have resolved the problem.
Solution Code:
validateRemoveItem: (list, item) {
list!.remove(item);
for (var ele in list) {
if (ele.toString() == item.toString()) {
list.remove(ele);
break;
}
}
return list.cast<T>();
},
Describe the Bug
I have a homepage that displays a calendar and the events for the selected day. After I click on the filter icon, it displays a
ModalBottomSheet
. When I click on the filter, thisModalBottomSheet
appears and opens using theshowModalBottomSheet
method. This builds a new component where theFilterDialog
and the rest of the page are constructed.When tapping on a read-only text field, it triggers the function to build the
FilterDialog
. Everything seems to work fine initially, but after I select one or more items, close theModalBottomSheet
, and then reopen it, the problem appears.https://github.com/TheAlphamerc/filterlist/assets/151133021/c77acc74-a0fa-44ab-b4d7-e0ba1bba7881
I tried to fix the problem using the
validateRemoveItem
, and it does what it's supposed to do by removing the element from the list. However, the issue is that it doesn't update the UI immediately. The UI only refreshes if I click on another item. Is there a way to reload the UI or another method to resolve this problem?This is the code of the pages:
HomePage
ContainerEvents
FilterBox