DesignTagInput<T extends Object> class
Values chosen as tags, with a field that suggests and makes more.
It holds no list of its own: values in, onChanged out. The look paints each tag (tagBuilder), the field (fieldBuilder), each suggestion (optionBuilder) and the layout (layoutBuilder). The suggestions open from the whole layout (the face round the tags and the field, when the layout draws one), as wide as it and on its leading edge, not from the field after the tags.
DesignTagInput<String>(values: const ['red'], onChanged: (values) {}, onCreate: (text) => text, fieldBuilder: (context, field) => EditableText(controller: field.controller, focusNode: field.focusNode, style: const TextStyle(), cursorColor: const Color(0xFF000000), backgroundCursorColor: const Color(0xFF808080), onEditingComplete: field.submit), optionBuilder: (context, option, states) => Text(option), tagBuilder: (context, value, tag) => Text(value))
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- DesignTagInput
Constructors
-
DesignTagInput({Key? key, required List<
T> values, required ValueChanged<List< onChanged, required DesignComboboxFieldBuilder fieldBuilder, required DesignOptionBuilder<T> >T> optionBuilder, required DesignTagBuilder<T> tagBuilder, Iterable<T> options = const [], DesignOptionSearch<T> ? search, bool isOptionEnabled(T option)?, bool highlightFollowsPointer = false, String displayStringForOption(T value) = _string, T? onCreate(String text)?, DesignTagLayoutBuilder? layoutBuilder, DesignListSurfaceBuilder? surfaceBuilder, int? maxTags, List<String> separators = const [','], TextEditingController? controller, FocusNode? focusNode, double optionsMaxHeight = 300, String? semanticLabel, String? deleteLabel, Duration? debounceDuration, WidgetBuilder? loadingBuilder, DesignSearchErrorBuilder? errorBuilder}) -
A tag input over
values.const
Properties
- controller → TextEditingController?
-
The field's text, when the caller holds it. The caller disposes it;
null: the tag input makes its own and disposes it.
final
- debounceDuration → Duration?
-
How long typing rests before search runs: a search per pause, not
per letter. Null (the default) runs it at every change. Filtering
options never waits.
final
- deleteLabel → String?
-
The screen reader's action that removes a tag; null:
DesignLocalizations.tagInputDeleteLabel.
final
- displayStringForOption → String Function(T value)
-
A value's text.
final
- errorBuilder → DesignSearchErrorBuilder?
-
Says that search failed, in the list's surface, with a way to try
again (DesignSearchError.retry; Down moves the keys there, Enter
runs it); a screen reader hears
DesignLocalizations.searchFailedMessage as it appears, and the focus
stays in the field. Null (the default): the list closes and the error
goes to FlutterError.reportError.
final
- fieldBuilder → DesignComboboxFieldBuilder
-
Paints the field.
final
- focusNode → FocusNode?
-
The field's focus, when the caller holds it. The caller disposes it;
null: the tag input makes its own and disposes it.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- highlightFollowsPointer → bool
-
Whether the pointer moves the suggestions' highlight, as
DesignCombobox.highlightFollowsPointer; off: two places, the
pointer's WidgetState.hovered and the keys' WidgetState.focused.
final
- isOptionEnabled → bool Function(T option)?
-
Whether a suggestion can be taken; null: all can. A disabled one shows
WidgetState.disabled; the highlight passes over it, and neither a tap
nor Enter takes it.
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- layoutBuilder → DesignTagLayoutBuilder?
-
Lays out the tags and the field (a face round both, when the look
draws one); the suggestions open from what it lays out.
final
- loadingBuilder → WidgetBuilder?
-
Says that search is finding options, in the list's surface, while its
future is pending (and while debounceDuration runs); a screen reader
hears DesignLocalizations.loadingLabel as it appears. Null (the
default): the options found last stay until the new ones come.
final
- maxTags → int?
-
The most tags it takes; null for no limit.
final
-
onChanged
→ ValueChanged<
List< T> > -
Called with the new list when a tag is added or removed.
final
- onCreate → T? Function(String text)?
-
Makes a value of free text, or null to refuse it; null for no free
text (only suggestions are taken).
final
-
optionBuilder
→ DesignOptionBuilder<
T> -
Paints one suggestion.
final
-
options
→ Iterable<
T> -
What typing suggests (less what is chosen), when there is no
search.
final
- optionsMaxHeight → double
-
The suggestion list's greatest height.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
search
→ DesignOptionSearch<
T> ? -
Finds suggestions for a query, in place of filtering options.
final
- semanticLabel → String?
-
What a screen reader calls the suggestions.
final
-
separators
→ List<
String> -
Text that ends a tag as it is typed or pasted.
final
- surfaceBuilder → DesignListSurfaceBuilder?
-
Paints the suggestion list's surface.
final
-
tagBuilder
→ DesignTagBuilder<
T> -
Paints one tag.
final
-
values
→ List<
T> -
The chosen values, in order.
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< DesignTagInput< 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.
override
-
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