UI libraries
/
Algolia for Flutter
/
Widgets
Sep 05, 2024
Clear Filters
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.
Copy
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?