closeSearch method

void closeSearch({
  1. bool clearText = false,
})

Closes the search morph and returns the bar to regular tab mode.

If clearText is true, any query text currently entered in the search input field is cleared. Defaults to false, preserving the existing query text.

If the bar is not in search mode or has been disposed, calling this method is an idempotent no-op.

Implementation

void closeSearch({bool clearText = false}) {
  if (_disposed || !_searching) return;
  _clearTextOnClose = clearText;
  _searching = false;
  notifyListeners();
}