PrismChipInput class
A free-form tag/chip input: type, press Enter or comma, get a chip.
Handles the awkward parts of tag entry so you don't have to: paste of comma- or newline-separated lists, backspace-to-delete-last, duplicate rejection, an optional maximum, and validation feedback.
PrismChipInput(
label: 'Labels',
value: labels,
suggestions: const ['work', 'personal', 'urgent'],
onChanged: (next) => setState(() => labels = next),
)
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- PrismChipInput
Constructors
-
PrismChipInput({Key? key, required List<
String> value, required ValueChanged<List< onChanged, String? label, String? hint, String? helperText, String? errorText, List<String> >String> suggestions = const [], int? maxChips, bool allowDuplicates = false, bool enabled = true, TextInputAction textInputAction = TextInputAction.done, Widget chipBuilder(BuildContext context, String label, VoidCallback remove)?, String? validator(String value)?, Set<String> delimiters = const {',', '\n', ';'}, IconData? leadingIcon}) -
Creates a chip input.
const
Properties
- allowDuplicates → bool
-
Whether the same label may appear twice.
final
- chipBuilder → Widget Function(BuildContext context, String label, VoidCallback remove)?
-
Replaces the default chip rendering.
final
-
delimiters
→ Set<
String> -
Characters that commit the current entry when typed.
final
- enabled → bool
-
Whether the field accepts input.
final
- errorText → String?
-
Error text under the field; overrides helperText when non-null.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- helperText → String?
-
Helper text under the field.
final
- hint → String?
-
Placeholder shown when the field is empty.
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- label → String?
-
Field label rendered above the input.
final
- leadingIcon → IconData?
-
Optional leading icon.
final
- maxChips → int?
-
Reject new chips once this many exist.
final
-
onChanged
→ ValueChanged<
List< String> > -
Called with the updated list whenever a chip is added or removed.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
suggestions
→ List<
String> -
Optional suggestion list offered as overlay chips when the field is
focused and the query matches.
final
- textInputAction → TextInputAction
-
Keyboard action for the text field.
final
- validator → String? Function(String value)?
-
Validates an individual entry before it is accepted. Return an error
message to reject it.
final
-
value
→ List<
String> -
Current chips. The widget never mutates this list — it calls
onChanged with a new one.
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< PrismChipInput> -
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, 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