ChipsInput<T> constructor
ChipsInput<T> ({
- Key? key,
- required String id,
- Iterable<
T> ? initialValue, - InputDecoration decoration = const InputDecoration(),
- bool enabled = true,
- required BuildChipsWidget<
T> chipBuilder, - BuildChipsWidget<
T> ? suggestionBuilder, - GenerateSuggestions<
T> ? findSuggestions, - String? placeholder,
- double? elevation,
- ChipTokenizer<
T> ? chipTokenizer, - ValueChanged<
T> ? onChipTapped, - QueryChanged<
T> ? onQueryChanged, - OnLostFocus<
T> ? onLostFocus, - ChipsChanged<
T> ? onChipsChanged, - int? maxChips,
- VoidCallback? onSwipeClosed,
- TextInputConfiguration? inputConfiguration,
- bool? autofocus,
- FocusNode? focusNode,
- String? query,
- PerformTextInputAction<
T> ? onInputAction, - bool? hideSuggestionsOverlay,
- ChipAction<
T> ? onSuggestionTap, - ChipsInputController<
T> ? controller, - ChipIdentifier<
T> ? chipId,
Implementation
ChipsInput({
Key? key,
required this.id,
/// The chips that should start in the input. If a controller is also provided, this will perform a sync once the
/// component loads for the first time
Iterable<T>? initialValue,
/// Decoration for the input itself
this.decoration = const InputDecoration(),
this.enabled = true,
/// Builds each individual chip
required this.chipBuilder,
/// Builds an individual suggestion tile.
this.suggestionBuilder,
/// A callback for locating suggestions based on the state of the input
this.findSuggestions,
/// Placeholder text to display.
this.placeholder,
this.elevation,
/// Tokenizes each chip so we can perform full-text lookups
this.chipTokenizer,
/// Called when a chip is tapped
this.onChipTapped,
/// Callback for when the query text changes
this.onQueryChanged,
/// When the input loses focus
this.onLostFocus,
/// When the list of chips changes
this.onChipsChanged,
/// The max number of chips to allow
this.maxChips,
/// When the user swipes and the input is empty
this.onSwipeClosed,
/// Configuration for the text input itself.
this.inputConfiguration,
/// Whether to autofocus the input
this.autofocus,
/// Used for focusing the input itself
this.focusNode,
/// Optional - starting query
this.query,
this.onInputAction,
/// Whether to hide/ignore the suggestions overlay
this.hideSuggestionsOverlay,
/// When an inline suggestion is present and tapped.
this.onSuggestionTap,
/// A controller used to manually adjust chips, suggestions, etc
this.controller,
/// Calculates an identifier for each chip.
this.chipId,
}) : initialValue = initialValue?.where((s) => s != null).toList(),
assert(maxChips == null || initialValue!.length <= maxChips),
assert(controller == null || findSuggestions == null),
super(key: key ?? Key("chips-input-$id"));