ChipsInputAutocomplete class
The ChipsInputAutocomplete widget is a text field that allows the user to input and create chips out of it, with autocomplete support.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- ChipsInputAutocomplete
Constructors
-
ChipsInputAutocomplete({Key? key, bool placeChipsSectionAbove = true, BoxDecoration widgetContainerDecoration = const BoxDecoration(), double spacing = 5.0, double? runSpacing, bool? secondaryTheme, ChipThemeData? chipTheme, Clip? chipClipBehavior, String? deleteButtonTooltipMessage, EdgeInsets paddingInsideWidgetContainer = const EdgeInsets.all(8.0), FocusNode? focusNode, bool autoFocus = false, List<
String> createCharacters = const <String>[',', ' '], Widget? deleteIcon = const Padding(padding: EdgeInsets.only(left: 4), child: Icon(Icons.close, size: 16)), String? validateInputMethod(String?)?, String? validateChipsMethod(List<String> ?)?, AutovalidateMode? autovalidateMode, bool enabled = true, String eraseKeyLabel = 'Backspace', GlobalKey<FormFieldState< ? formFieldKey, bool addChipOnSelection = false, void onChanged(List<List< >String> >String> ?)?, void onChangedTextField(String)?, void onEditingCompleteTextField()?, void onSaved(List<String> ?)?, void onChipDeleted(String, int)?, void onChipAdded(String)?, void onChipsCleared()?, bool useDefaultOnChipDeleted = true, bool useDefaultOnChipAdded = true, bool useDefaultOnChipsCleared = true, bool showClearButton = false, bool clearWithConfirm = true, ChipsAutocompleteController? controller, List<String> ? options, List<String> ? initialChips, bool showOnlyUnselectedOptions = true, int minLines = 1, bool enableSuggestions = true, bool showCursor = true, double cursorWidth = 2.0, double? cursorHeight, Radius? cursorRadius, Color? cursorColor, TextInputType keyboardType = TextInputType.text, InputDecoration decorationTextField = const InputDecoration(border: InputBorder.none, contentPadding: EdgeInsets.only(left: 8.0), constraints: BoxConstraints(maxWidth: _kTextFieldWidth), hintText: 'Type...'), double? optionsMaxWidth}) -
Creates a ChipsInputAutocomplete widget.
const
Properties
- addChipOnSelection → bool
-
If true, the text field will add a chip when the user selects an option. If false, selected option will be added to the text field.
final
- autoFocus → bool
-
Whether to autofocus the widget.
final
- autovalidateMode → AutovalidateMode?
-
The autovalidate mode for the form field.
final
- chipClipBehavior → Clip?
-
The clip behavior for the chips.
final
- chipTheme → ChipThemeData?
-
The theme for the chips.
If
null, the default theme will be used. Can be set toChipThemeData.secondaryfor a secondary theme.final - clearWithConfirm → bool
-
Whether to clear all chips with a confirmation dialog.
final
- controller → ChipsAutocompleteController?
-
The controller for the chips, autocomplete options and textfield.
final
-
createCharacters
→ List<
String> -
The input character used for creating a chip.
final
- cursorColor → Color?
-
The color to use when painting the cursor.
final
- cursorHeight → double?
-
The height of the cursor.
final
- cursorRadius → Radius?
-
The radius of the cursor.
final
- cursorWidth → double
-
The width of the cursor.
final
- decorationTextField → InputDecoration
-
The style of the textfield.
final
- deleteButtonTooltipMessage → String?
-
Tooltip message for the delete button.
final
- deleteIcon → Widget?
-
Icon for the delete method.
Defaults to a close icon.
Can be set to null to remove the delete icon.
final
- enabled → bool
-
Whether the form field is enabled.
final
- enableSuggestions → bool
-
whether to show suggestions
final
- eraseKeyLabel → String
-
The key label used for erasing a chip. Defaults to Backspace.
final
- focusNode → FocusNode?
-
FocusNode for the text field.
final
-
formFieldKey
→ GlobalKey<
FormFieldState< ?List< >String> > -
FormField key to access or validate the form outside the widget.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
-
initialChips
→ List<
String> ? -
The initial chips.
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- keyboardType → TextInputType
-
keyboard type for the textfield
final
- minLines → int
-
The maximum number of lines for the text field.
Currently not supported
The minimum number of lines for the text field.
final
-
onChanged
→ void Function(List<
String> ?)? -
Callback when the chips value changes.
final
- onChangedTextField → void Function(String)?
-
Callback when the text field changes.
final
- onChipAdded → void Function(String)?
-
Callback when a chip is added. Returns the added chip content.
final
- onChipDeleted → void Function(String, int)?
-
Callback when a chip is deleted. Returns the deleted chip content and index.
final
- onChipsCleared → void Function()?
-
Callback when all chips are cleared.
final
- onEditingCompleteTextField → void Function()?
-
Callback when editing of textField is complete.
final
-
onSaved
→ void Function(List<
String> ?)? -
Callback when the form is saved.
final
-
options
→ List<
String> ? -
The options for the autocomplete.
final
- optionsMaxWidth → double?
-
The maximum width of the optionsView.
final
- paddingInsideWidgetContainer → EdgeInsets
-
Padding inside the main widget container;
final
- placeChipsSectionAbove → bool
-
Whether to place the chips section above or below the text field.
final
- runSpacing → double?
-
Spacing between the rows of chips.
If
null, the spacing value will be used.final - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- secondaryTheme → bool?
-
Whether to use the secondary theme.
final
- showClearButton → bool
-
Whether to show the clear button.
final
- showCursor → bool
-
whether to show the cursor
final
- showOnlyUnselectedOptions → bool
-
Whether to show only options that are not already chips.
final
- spacing → double
-
Spacing between the chips.
Defaults to 5.0.
final
- useDefaultOnChipAdded → bool
-
Whether to use the default onChipAdded method.
Maybe set to false for a different logic. For example, when chips are updated from a different source.
final
- useDefaultOnChipDeleted → bool
-
Whether to use the default onChipDeleted method.
Maybe set to false for a different logic. For example, when chips are updated from a different source.
final
- useDefaultOnChipsCleared → bool
-
Whether to use the default onChipsCleared method.
Maybe set to false for a different logic. For example, when chips are updated from a different source.
final
-
validateChipsMethod
→ String? Function(List<
String> ?)? -
Validation method for the chips.
The validation method is called after a chip is added. For validating when a chip is added use validateInputMethod.
Returns a
stringif the input is invalid. If Null, the input is always valid.final - validateInputMethod → String? Function(String?)?
-
Validation method for the input.
The validation method is called when a chip is added. For validating afterwards use validateChipsMethod.
Returns a
stringif the input is invalid. If Null, the input is always valid.final - widgetContainerDecoration → BoxDecoration
-
Decoration for the main widget container.
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< ChipsInputAutocomplete> -
Creates the State for the ChipsInputAutocomplete widget.
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