GlassSearchBarConfig class

Configuration for the morphing search bar in GlassSearchableBottomBar.

When the user taps the collapsed search pill, onSearchToggle is called with true. Set GlassSearchableBottomBar.isSearchActive to true to expand the search bar and collapse the tab pill.

Example

GlassSearchableBottomBar(
  tabs: [...],
  selectedIndex: _tab,
  onTabSelected: (i) => setState(() => _tab = i),
  isSearchActive: _searching,
  searchConfig: GlassSearchBarConfig(
    onSearchToggle: (v) => setState(() => _searching = v),
    hintText: 'Apple News',
    collapsedLogoBuilder: (ctx) => ..., // N logo shown when searching
  ),
)

Constructors

GlassSearchBarConfig({required ValueChanged<bool> onSearchToggle, String hintText = 'Search', double? collapsedTabWidth, WidgetBuilder? collapsedLogoBuilder, Color? searchIconColor, Widget? searchIcon, Color? micIconColor, TextStyle? hintStyle, TextEditingController? controller, FocusNode? focusNode, ValueChanged<String>? onChanged, ValueChanged<String>? onSubmitted, VoidCallback? onMicTap, Color? textColor, Color? cursorColor, WidgetBuilder? trailingBuilder, TextInputAction? textInputAction, TextInputType? keyboardType, bool autocorrect = true, bool enableSuggestions = true, TapRegionCallback? onTapOutside, bool autoFocusOnExpand = false, bool expandWhenActive = true, bool showsCancelButton = true, Color? cancelButtonColor, Widget? cancelIcon, double cancelIconSize = 24, ValueChanged<bool>? onSearchFocusChanged, VoidCallback? onSearchFieldTap, VoidCallback? onCancelTap})
Creates a search bar configuration.
const

Properties

autocorrect → bool
Whether to enable autocorrection for the search TextField.
final
autoFocusOnExpand → bool
Whether the search TextField should automatically receive keyboard focus when the search bar expands.
final
cancelButtonColor → Color?
Color of the cancel (×) icon.
final
cancelIcon → Widget?
Custom icon widget for the cancel (dismiss) button.
final
cancelIconSize → double
Size of the cancel (×) icon in logical pixels.
final
collapsedLogoBuilder → WidgetBuilder?
Widget shown inside the collapsed tab pill when search is active.
final
collapsedTabWidth → double?
Width of the collapsed tab pill when search is active.
final
controller → TextEditingController?
Optional controller for the search text field.
final
cursorColor → Color?
Color of the text cursor (blinking caret) in the expanded search field.
final
enableSuggestions → bool
Whether to show input suggestions (QuickType bar on iOS) for the search TextField.
final
expandWhenActive → bool
Whether the search pill expands horizontally to fill the available width when search is active.
final
focusNode → FocusNode?
Optional focus node for the search text field.
final
hashCode → int
The hash code for this object.
no setterinherited
hintStyle → TextStyle?
Text style for the hint text. Uses a sensible default when null.
final
hintText → String
Placeholder text in the expanded search bar. Defaults to 'Search'.
final
keyboardType → TextInputType?
The type of keyboard to display for the search TextField.
final
micIconColor → Color?
Color for the microphone icon specifically. Falls back to searchIconColor.
final
onCancelTap → VoidCallback?
Called when the user taps the dismiss (×) cancel pill to close the keyboard.
final
onChanged → ValueChanged<String>?
Called on every keystroke as the user types in the search field.
final
onMicTap → VoidCallback?
Called when the user taps the microphone icon.
final
onSearchFieldTap → VoidCallback?
Called when the user taps the body of the active (expanded) search field.
final
onSearchFocusChanged → ValueChanged<bool>?
Called whenever the search field gains or loses keyboard focus.
final
onSearchToggle → ValueChanged<bool>
Called with true when search is activated, false when dismissed.
final
onSubmitted → ValueChanged<String>?
Called when the user submits the search (keyboard action).
final
onTapOutside → TapRegionCallback?
Called when the user taps outside the expanded search TextField.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
searchIcon → Widget?
Custom widget rendered in place of the default magnifying-glass icon on the collapsed search pill. When non-null, searchIconColor is ignored for this particular slot — the caller's widget is expected to handle its own coloring.
final
searchIconColor → Color?
Color for the 🔍 and 🎤️ icons. Defaults to CupertinoColors.secondaryLabel (adapts to light/dark mode).
final
showsCancelButton → bool
Whether to show a cancel/dismiss button when the search bar is focused.
final
textColor → Color?
Color of the typed text. Defaults to CupertinoColors.label (adapts to light/dark mode).
final
textInputAction → TextInputAction?
The keyboard action button label for the search TextField.
final
trailingBuilder → WidgetBuilder?
Custom widget builder for the trailing section of the expanded search bar.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

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