I'm building a Flutter application and have a SearchDelegate function where I'm trying to put filters as a complement to the query. To do so, I have a buildActions button that displays the list of filters, you can choose what you want, and then the popup disappears and returns the list of filters. I'm trying to force a reload of the search :
List buildActions(BuildContext context) { cubit.clearSearchResults(); return [ IconButton( icon: const Icon( ThemeIcon.clear, ), onPressed: query.isEmpty ? null : () => query = '', ), query.isNotEmpty ? IconButton( icon: const Icon( ThemeIcon.filter_list, ), onPressed: () async { Map? selectedValues = await showDialog( barrierDismissible: true, context: context, builder: (BuildContext context) { return FiltersPopup(filters); }, ); if (selectedValues != null) { filters = selectedValues["filters"]; // TODO : trigger rebuild } }, ) : const SizedBox.shrink(), ]; } I've tried :
- to change the query to force a reload but it's not working, the query is erased from the search bar but nothing happens after
- launch the function buildResults but without any success
Any help will be very appreciated
Источник: https://stackoverflow.com/questions/780 ... chdelegate
Мобильная версия