toggleSearch method
void
toggleSearch()
Toggles the search bar visibility.
If search is active, it clears the search query and refreshes the list. If search is inactive, it activates search mode and requests focus.
Implementation
void toggleSearch() {
if (isSearching) {
searchController.text = '';
isSearching = false;
filter.search = '';
filter.skip = 0;
pagingController.refresh();
return;
}
setState(() {
isSearching = true;
searchFocus.requestFocus();
});
}