AutoSuggestionsBox<T> class
Constructors
-
AutoSuggestionsBox({Key? key, AutoSuggestionsSource<T>? source, List<AutoSuggestion<T>>? items, AutoSuggestionsBoxController<T>? controller, ValueChanged<AutoSuggestion<T>>? onSelected, bool multiSelect = false, List<AutoSuggestion<T>>? initialSelected, ValueChanged<List<AutoSuggestion<T>>>? onSelectionChanged, ValueChanged<String>? onChanged, ValueChanged<String>? onSubmitted, String? hintText, String? label, Widget? leading, bool clearButton = true, AutoSuggestionMatch highlightMatch = AutoSuggestionMatch.contains, bool highlightMatches = true, bool openOnFocus = true, int maxVisibleRows = 8, double? width, bool enabled = true, bool autofocus = false, FocusNode? focusNode, bool bare = false, double? fieldHeight, TextStyle? textStyle, VoidCallback? onEscape, VoidCallback? onTabNext, VoidCallback? onTabPrev, bool scrollOnFocus = true, Widget itemBuilder(BuildContext, AutoSuggestion<T>, bool highlighted)?, Widget emptyBuilder(BuildContext, String query)?, Widget loadingBuilder(BuildContext, String query)?})
-
const
Properties
-
autofocus
→ bool
-
final
-
bare
→ bool
-
Embed mode: drop the outer border + fill and tighten padding so the box
sits flush inside a host surface (e.g. an EditableTable cell). The overlay
dropdown is unchanged.
final
-
clearButton
→ bool
-
Show the clear (×) button when there's text.
final
-
controller
→ AutoSuggestionsBoxController<T>?
-
An externally-owned controller. When null, one is created from
source/items and disposed with the widget.
final
-
emptyBuilder
→ Widget Function(BuildContext, String query)?
-
Shown inside the overlay when a non-empty query has no matches.
final
-
enabled
→ bool
-
final
-
fieldHeight
→ double?
-
Override the field's min height (defaults to AutoSuggestionsBoxThemeData.fieldHeight).
final
-
focusNode
→ FocusNode?
-
final
-
hashCode
→ int
-
The hash code for this object.
no setterinherited
-
highlightMatch
→ AutoSuggestionMatch
-
How matches are highlighted in each row.
final
-
highlightMatches
→ bool
-
Highlight the matched substring in bold/accent.
final
-
hintText
→ String?
-
Placeholder shown when empty.
final
-
initialSelected
→ List<AutoSuggestion<T>>?
-
Pre-selected rows for multiSelect (ignored when a controller is given).
final
-
itemBuilder
→ Widget Function(BuildContext, AutoSuggestion<T>, bool highlighted)?
-
Custom row renderer (overrides the default label/description/icon row).
final
-
items
→ List<AutoSuggestion<T>>?
-
Shorthand static source: a list of suggestions (filtered by
contains).
final
-
key
→ Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
-
label
→ String?
-
Field label rendered above the box (optional).
final
-
leading
→ Widget?
-
Leading widget inside the field (defaults to a search icon). Pass
SizedBox.shrink() to remove it.
final
-
loadingBuilder
→ Widget Function(BuildContext, String query)?
-
Shown inside the overlay while an async source is loading and there are no
results yet (e.g. a skeleton). When null, a default spinner row is used.
(A small spinner also always appears in the field's suffix while loading.)
final
-
maxVisibleRows
→ int
-
Max rows visible before the overlay scrolls.
final
-
multiSelect
→ bool
-
Enable multi-select: tapping / Enter toggles a row in a set and the overlay
stays open (rows show a checkbox; a count shows in the field). Read the set
from the controller's
selectedItems, or listen via onSelectionChanged.
final
-
onChanged
→ ValueChanged<String>?
-
Fired on every text change.
final
-
onEscape
→ VoidCallback?
-
Pressing Escape calls this (used by embedders like a table cell to cancel
the edit). When null, Escape just closes the overlay.
final
-
onSelected
→ ValueChanged<AutoSuggestion<T>>?
-
Fired when a row is picked (tap or Enter on a highlighted match).
final
-
onSelectionChanged
→ ValueChanged<List<AutoSuggestion<T>>>?
-
Fired (multi-select) whenever the chosen set changes, with the full set.
final
-
onSubmitted
→ ValueChanged<String>?
-
Fired when Enter is pressed with no highlighted match and free text is
allowed (a "submit raw query" affordance).
final
-
onTabNext
→ VoidCallback?
-
Pressing Tab / Shift+Tab calls these (commit + move to the next/prev cell).
When null, Tab performs normal focus traversal.
final
-
onTabPrev
→ VoidCallback?
-
final
-
openOnFocus
→ bool
-
Open the overlay when the field gains focus.
final
-
runtimeType
→ Type
-
A representation of the runtime type of the object.
no setterinherited
-
scrollOnFocus
→ bool
-
When the field gains focus, scroll it into view inside the nearest
scrollable ancestor (so a box low in a long form / list isn't left under
the fold or the keyboard, and the overlay has room to open). Uses
Scrollable.ensureVisible. Set false to opt out.
final
-
source
→ AutoSuggestionsSource<T>?
-
Provide a source (or items) — or a fully-owned controller.
final
-
textStyle
→ TextStyle?
-
Base text style for the typed value (size/family). Falls back to the DS body.
final
-
width
→ double?
-
Fixed field width (otherwise fills the parent).
final