SearchableBottomBarController class

Manages the layout state machine for GlassSearchableBottomBar.

Owns the spring target computation, change-detection cache, and focus state so that this logic can be unit tested without a widget tree.

Usage

Create and hold in a State (or provide via a parent widget):

final _searchController = SearchableBottomBarController();

@override
void dispose() {
  _searchController.dispose();
  super.dispose();
}

Pass to the widget:

GlassSearchableBottomBar(
  controller: _searchController,
  ...
)

Open/close search programmatically via the controller:

_searchController.openSearch();  // expands search bar
_searchController.closeSearch(); // collapses back to tabs

Or by driving GlassSearchableBottomBar.isSearchActive directly from your own state — both approaches work and are interchangeable.

Inheritance

Properties

cachedTotalW double
Last known total available width — used to detect layout invalidation.
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
hasListeners bool
Whether any listeners are currently registered.
no setterinherited
isSearchOpen bool
Whether the search bar is currently open (expanded).
no setter
pillsInitialized bool
False until the first initializePills call completes.
no setter
pillsInitScheduled bool
True while an init post-frame callback is pending.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
searchFocused bool
Whether the search text field is currently focused (keyboard visible).
no setter

Methods

addListener(VoidCallback listener) → void
Register a closure to be called when the object changes.
inherited
checkRetarget(SearchablePillLayout layout) SpringRetarget
Compares layout targets against the cached previous targets and returns which axes have changed.
closeSearch() → void
Collapses the search bar back to the tab view.
computeLayout({required double totalW, required bool searching, required bool expandWhenActive, required double barHeight, required double searchBarHeight, required double spacing, required bool hasDismiss, required bool dismissVisible, required double? collapsedTabWidth, required GlassTabPillAnchor tabPillAnchor, required double extraFullW, required ExtraButtonPosition extraPos, required bool extraCollapsesOnSearch, required bool isKeyboardActive, required double keyboardH, required int tabCount, required double? perTabWidth}) SearchablePillLayout
Computes pill layout targets from the given constraints.
dispose() → void
Discards any resources used by the object. After this is called, the object is not in a usable state and should be discarded (calls to addListener will throw after the object is disposed).
inherited
initializePills({required double tabW, required double searchLeft, required double searchW}) → void
Called in the post-frame callback after the first layout pass.
markInitScheduled({required double totalW}) → void
Marks initialization as scheduled (guard against duplicate callbacks).
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyListeners() → void
Call all the registered listeners.
inherited
onFocusChanged(bool focused) → void
Called when the search text field gains or loses keyboard focus.
onSearchActiveChanged({required bool wasActive, required bool isActive}) → void
Called from didUpdateWidget when GlassSearchableBottomBar.isSearchActive changes.
openSearch() → void
Expands the search bar.
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes.
inherited
syncSearchActive(bool isActive) → void
Synchronises isSearchOpen with the parent widget's isSearchActive prop.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

makeSpring({required SpringDescription spring, required double from, required double to}) SpringSimulation
Creates a SpringSimulation from fromto using spring.