SmartSearchOverlay<T> class
A widget that combines SmartSearchBox with an overlay dropdown for results.
The overlay automatically positions itself in the best available space (top, bottom, left, or right) relative to the search box, unless a specific position is configured.
Example:
SmartSearchOverlay<Product>(
controller: searchController,
itemBuilder: (context, product) => ListTile(
title: Text(product.name),
subtitle: Text('\$${product.price}'),
),
onItemSelected: (product) {
// Handle selection
},
)
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- SmartSearchOverlay
Constructors
-
SmartSearchOverlay({Key? key, required SmartSearchController<
T> controller, required Widget itemBuilder(BuildContext context, T item), ValueChanged<T> ? onItemSelected, InputDecoration? searchBoxDecoration, SmartSearchOverlayConfig overlayConfig = const SmartSearchOverlayConfig(), WidgetBuilder? loadingBuilder, WidgetBuilder? emptyBuilder, Widget errorBuilder(BuildContext context, Exception error)?, IndexedWidgetBuilder? separatorBuilder, WidgetBuilder? headerBuilder, BoxDecoration? overlayDecoration, TextStyle? searchBoxStyle, Widget? searchBoxPrefixIcon, Widget? searchBoxSuffixIcon, bool showClearButton = true, BorderRadius? searchBoxBorderRadius}) -
const
Properties
-
controller
→ SmartSearchController<
T> -
The search controller managing the search state.
final
- emptyBuilder → WidgetBuilder?
-
Builder for the empty state in the overlay.
final
- errorBuilder → Widget Function(BuildContext context, Exception error)?
-
Builder for the error state in the overlay.
final
-
Builder for a footer below the results list.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- headerBuilder → WidgetBuilder?
-
Builder for a header above the results list.
final
- itemBuilder → Widget Function(BuildContext context, T item)
-
Builder for each result item.
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- loadingBuilder → WidgetBuilder?
-
Builder for the loading state in the overlay.
final
-
onItemSelected
→ ValueChanged<
T> ? -
Called when an item is selected from the results.
final
- overlayConfig → SmartSearchOverlayConfig
-
Configuration for the overlay appearance and behavior.
final
- overlayDecoration → BoxDecoration?
-
Decoration for the overlay container.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- searchBoxBorderRadius → BorderRadius?
-
Border radius for the search box.
final
- searchBoxDecoration → InputDecoration?
-
Decoration for the search text field.
final
- searchBoxPrefixIcon → Widget?
-
Prefix icon for the search box.
final
- searchBoxStyle → TextStyle?
-
Text style for the search box.
final
- searchBoxSuffixIcon → Widget?
-
Suffix icon for the search box.
final
- separatorBuilder → IndexedWidgetBuilder?
-
Builder for separators between items.
final
- showClearButton → bool
-
Whether to show a clear button in the search box.
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< SmartSearchOverlay< T> > -
Creates the mutable state for this widget at a given location in the tree.
override
-
debugDescribeChildren(
) → List< DiagnosticsNode> -
Returns a list of DiagnosticsNode objects describing this node's
children.
inherited
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringDeep(
{String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → String -
Returns a string representation of this node and its descendants.
inherited
-
toStringShallow(
{String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a one-line detailed description of the object.
inherited
-
toStringShort(
) → String -
A short, textual description of this widget.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited