FieldSuggestion<T> class

Create highly customizable, simple, and controllable autocomplete fields.

Widget Structure: ╭───────╮ ╭─────────────╮ │ Input │╮ ╭│ Suggestions │ ╰───────╯│ │╰─────────────╯ │ │ │ │ Generated by │ Element search algorithm │ │ ╭──────────╮ ▼ ▼ ╭──▶│ Matchers │─╮ ╭──────────────────╮ │ ╰──────────╯ │ ╭──────────────╮ │ Search Algorithm │──╯ ╰─▶│ Item Builder │ ╰──────────────────╯ ╰──────────────╯ Passes input and suggestion's ... Passes context and element to search function. index of "matcher in suggestions". So, as a result matchers suggestion item widget. fill be filled appropriate to algorithm

──────────────────────────────────

Basic usage example:

FieldSuggestion(
   textController: _textController,
   suggestions: suggestions,
   search: (item, input) {
      return item.toString().contains(input);
   },
   itemBuilder: (context, index) {
      return Card(...);
   },
   ...
)

──────────────────────────────────

For mode details about usage refer to:

https://github.com/theiskaa/field_suggestion/wiki

Inheritance

Constructors

FieldSuggestion({Key? key, required Widget itemBuilder(BuildContext, int), Widget separatorBuilder(BuildContext, int)?, required TextEditingController textController, required List<T> suggestions, required bool search(T item, String input), BoxController? boxController, BoxStyle? boxStyle, InputDecoration? inputDecoration, TextInputType? inputType, FocusNode? focusNode, int? maxLines, TextStyle? inputStyle, FormFieldValidator<String>? validator, double cursorWidth = 2, double? cursorHeight, Radius? cursorRadius, Color? cursorColor, Brightness? keyboardAppearance, ScrollController? scrollController, double spacer = 5.0, int? sizeByItem, EdgeInsets padding = const EdgeInsets.all(12), bool wOpacityAnimation = false, bool wSlideAnimation = false, Duration animationDuration = const Duration(milliseconds: 400), SlideStyle slideStyle = SlideStyle.RTL, Tween<Offset>? slideOffset, Curve slideCurve = Curves.decelerate})
const

Properties

animationDuration Duration
Duration of suggestion box animation.
final
boxController BoxController?
Controller object of suggestions box.
final
boxStyle BoxStyle?
Suggestion's box style.
final
cursorColor Color?
The color of field's cursor.
final
cursorHeight double?
The height(length) of field's cursor.
final
cursorRadius Radius?
The border radius of field's cursor.
final
cursorWidth double
The width(thickness) of field's cursor.
final
focusNode FocusNode?
Focus node of input field.
final
hashCode int
The hash code for this object.
no setterinherited
inputDecoration InputDecoration?
Text input decoration of input field.
final
inputStyle TextStyle?
Text style of input field.
final
inputType TextInputType?
Text input type of input field.
final
itemBuilder Widget Function(BuildContext, int)
Suggestion widget builder.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
keyboardAppearance Brightness?
The appearance of the keyboard. Honored only IOS devices, 'cause Apple is awesome.
final
maxLines int?
Max lines of the input field.
final
padding EdgeInsets
Padding of suggestion box's sub widgets.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
scrollController ScrollController?
Scroll controller for the suggestions list.
final
Search algorithm of widget. Basic example: (check if item contains input) ```dart search: (item, input) => item.toString().contains(input)
final
separatorBuilder → (Widget Function(BuildContext, int)?)
Separator builder for suggestions list.
final
sizeByItem int?
Sets suggestion box's height by item count.
final
slideCurve Curve
Curve for box slide animation.
final
slideOffset Tween<Offset>?
Tween offset of slide animation.
final
slideStyle SlideStyle
Rotation slide to determine tween offset of slide animation.
final
spacer double
Spacer is the value of size between field and box.
final
suggestions List<T>
Suggestions list of widget.
final
textController TextEditingController
Main text editing controller.
final
validator FormFieldValidator<String>?
Field's input validator.
final
wOpacityAnimation bool
Boolean to disable/enable opacity animation of SuggestionBox.
final
wSlideAnimation bool
Boolean to enable/disable slide animation of SuggestionBox.
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() → _FieldSuggestionState
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