SearchField class
A debounced search input with a leading search icon and clear button.
Wraps Input (uniform field size, rounded-field, soft variant) and forwards
typing through onQueryChanged after a quiet period of
debounceDuration (300ms by default); onSubmitted fires immediately
on enter.
SearchField(onQueryChanged: (q) => model.filter(q))
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- SearchField
Constructors
-
SearchField({Key? key, TextEditingController? controller, String? placeholder = 'Search...', ValueChanged<
String> ? onQueryChanged, ValueChanged<String> ? onSubmitted, Duration debounceDuration = const Duration(milliseconds: 300), SizeToken? size, FieldVariant? variant, RadiusToken? radius, bool isInvalid = false, bool readOnly = false, bool disabled = false, bool fullWidth = false, bool autofocus = false, FocusNode? focusNode, TextInputType? keyboardType, TextInputAction textInputAction = TextInputAction.search, List<TextInputFormatter> ? inputFormatters, TextCapitalization textCapitalization = TextCapitalization.none, bool autocorrect = true, bool enableSuggestions = true, int? maxLength, VoidCallback? onEditingComplete, TapRegionCallback? onTapOutside}) -
Creates a SearchField.
const
Properties
- autocorrect → bool
-
Whether the platform may autocorrect the text.
final
- autofocus → bool
-
Focuses the field on first build.
final
- controller → TextEditingController?
-
Controls the field text; create your own to read it synchronously.
final
- debounceDuration → Duration
-
Quiet period before onQueryChanged fires.
final
- disabled → bool
-
Disables interaction at 50% opacity.
final
- enableSuggestions → bool
-
Whether the platform may show input suggestions.
final
- focusNode → FocusNode?
-
Controls and observes the field's focus.
final
- fullWidth → bool
-
Stretches to fill the parent width.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
-
inputFormatters
→ List<
TextInputFormatter> ? -
Formatters applied to the text as it is edited.
final
- isInvalid → bool
-
Marks the field as invalid, switching it to the error style.
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- keyboardType → TextInputType?
-
Keyboard type requested from the platform.
final
- maxLength → int?
-
Maximum number of characters accepted.
final
- onEditingComplete → VoidCallback?
-
Called when the user finishes editing, before onSubmitted.
final
-
onQueryChanged
→ ValueChanged<
String> ? -
Called after the debounce window once typing quiets down.
final
-
onSubmitted
→ ValueChanged<
String> ? -
Called on keyboard submit, bypassing the debounce.
final
- onTapOutside → TapRegionCallback?
-
Called when a pointer is pressed outside the field.
final
- placeholder → String?
-
Hint text shown while the field is empty.
final
- radius → RadiusToken?
-
Corner radius token. Defaults to FieldDefaults.radius, then
RadiusToken.field.
final
- readOnly → bool
-
Prevents editing while keeping the field focusable and selectable.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- size → SizeToken?
-
Field size token (affects text/icon scale). Defaults to FieldDefaults.size, then SizeToken.md.
final
- textCapitalization → TextCapitalization
-
How the platform keyboard capitalizes typed text.
final
- textInputAction → TextInputAction
-
Action button shown on the keyboard. Defaults to TextInputAction.search.
final
- variant → FieldVariant?
-
Visual style of the field. Defaults to FieldDefaults.variant, then
FieldVariant.outline.
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< SearchField> -
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