PrismSearch<T> class
An adaptive search widget.
- Compact windows (< 600px): tapping the field opens a full-screen search page — the pattern phone users expect.
- Medium+ windows: the field stays inline and suggestions drop down beneath it.
Provide either a local items list or an async onSearch backend.
PrismSearch<String>(
items: ['Dart', 'Flutter', 'Firebase'],
itemLabel: (item) => item,
onSelected: (item) => print('picked $item'),
)
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- PrismSearch
Constructors
-
PrismSearch({Key? key, List<
T> ? items, Future<List< onSearch(String query)?, required String itemLabel(T item), ValueChanged<T> >T> ? onSelected, String hintText = 'Search…', Duration? debounce, int maxSuggestions = 8, PrismSearchHighlightStyle? highlightStyle, InputDecoration? fieldDecoration, bool debugCompactOverride = false}) -
Creates an adaptive search.
const
Properties
- debounce → Duration?
-
Delay before onSearch fires while the user types.
Delay before onSearch fires while the user types. Defaults to
PrismTokens.durationMedium.
final
- debugCompactOverride → bool
-
Forces compact behavior (full-screen page) even on wide windows —
useful for previews and tests. Do not use in production code.
final
- fieldDecoration → InputDecoration?
-
Optional InputDecoration override for the search field.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- highlightStyle → PrismSearchHighlightStyle?
-
Styling for the matched substring in suggestions.
final
- hintText → String
-
Hint shown in the empty field.
final
- itemLabel → String Function(T item)
-
Renders the display string for a result item.
final
-
items
→ List<
T> ? -
Local dataset searched in memory. Mutually exclusive with onSearch.
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- maxSuggestions → int
-
Maximum number of suggestions shown at once.
final
-
onSearch
→ Future<
List< Function(String query)?T> > -
Async backend invoked (debounced) with the raw query.
Mutually exclusive with items.
final
-
onSelected
→ ValueChanged<
T> ? -
Invoked when the user picks a suggestion.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< PrismSearch< 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