Autocompleter<T> class
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- Autocompleter
Constructors
-
Autocompleter({Key? key, required TextEditingController controller, required Future<
List< callback(String text), required Widget itemBuilder(BuildContext context, T item), Widget emptyBuilder(BuildContext context)?, Widget loadingBuilder(BuildContext context)?, Widget errorBuilder(BuildContext context)?, bool beforeHook(String text)?, bool afterHook(List<T> >T> )?, void onTap(T suggestion)?, int debounce = 0, int? maxItems, double? maxHeight, BoxDecoration decorationBuilder(VerticalDirection direction)?, EdgeInsets padding(VerticalDirection direction)?, EdgeInsets margin(VerticalDirection direction)?, VerticalDirection direction = VerticalDirection.down, bool hideOnKeyboardDismissed = true, bool flip = false, Clip clipBehavior = Clip.hardEdge, required Widget child}) -
A customizable autocomplete widget for text field
const
Properties
-
afterHook
→ (bool Function(List<
T> )?) -
The hook to be invoked right after callback is called.
Useful for removing exact match from the list.
Return false to hide the suggestion list.
final
- beforeHook → (bool Function(String text)?)
-
The hook to be invoked right before callback is called.
Useful for performing validation, or length check before listing suggestions.
Return false to stop getting suggestion and hide the suggestion list.
final
-
callback
→ Future<
List< Function(String text)T> > -
Suggestion provider that should returns a list of
T
.final - child → Widget
-
Widget that the suggestion list should be attached to.
final
- clipBehavior → Clip
-
The clip behavior for the suggestion list.
final
- controller → TextEditingController
-
TextEditingController of the input field.
final
- debounce → int
-
Delay callback for specific time in milliseconds. Useful for avoid frequent calls to callback.
final
- decorationBuilder → (BoxDecoration Function(VerticalDirection direction)?)
-
The appearance of the suggestion list.
final
- direction → VerticalDirection
-
The direction of the suggestion list.
final
- emptyBuilder → (Widget Function(BuildContext context)?)
-
Content to be shown when the list returned by callback is empty.
final
- errorBuilder → (Widget Function(BuildContext context)?)
-
Widget to be shown when exception is thrown while executing callback.
final
- flip → bool
-
Flip to the other side when no spaces left for the current direction.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- hideOnKeyboardDismissed → bool
-
Hide the suggestion list when the keyboard is dismissed.
final
- itemBuilder → Widget Function(BuildContext context, T item)
-
Widget to be shown for each item in the list returned by callback.
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- loadingBuilder → (Widget Function(BuildContext context)?)
-
Widget to be shown when callback is executing.
final
- margin → (EdgeInsets Function(VerticalDirection direction)?)
-
The margin for suggestion list.
final
- maxHeight → double?
-
The maximum height of the list.
final
- maxItems → int?
-
The maximum items to be listed.
final
- onTap → (void Function(T suggestion)?)
-
The action when a list item is tapped.
final
- padding → (EdgeInsets Function(VerticalDirection direction)?)
-
The padding for suggestion list.
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(
) → _AutocompleterState< 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}) → 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