🎉 Try the public beta of the new docs site at algolia.com/doc-beta! 🎉
UI libraries / Algolia for Flutter / Widgets

About this widget

Let users clear all currently active refinements using FilterState by calling clear or clearExcept.

Examples

Following example uses a IconButton with a callback to clear all filters.

1
2
3
4
5
6
7
8
9
10
11
12
13
class ClearFilters extends StatelessWidget {
  const ClearFilters(this.filterState, {super.key});

  final FilterState filterState;

  @override
  Widget build(BuildContext context) {
    return IconButton(
      onPressed: () => filterState.clear(), // clear all filters
      icon: const Icon(Icons.clear_all),
    );
  }
}
Did you find this page helpful?