ChipsInput<T> constructor

ChipsInput<T>({
  1. Key? key,
  2. required String id,
  3. Iterable<T>? initialValue,
  4. InputDecoration decoration = const InputDecoration(),
  5. bool enabled = true,
  6. required BuildChipsWidget<T> chipBuilder,
  7. BuildChipsWidget<T>? suggestionBuilder,
  8. GenerateSuggestions<T>? findSuggestions,
  9. String? placeholder,
  10. double? elevation,
  11. ChipTokenizer<T>? chipTokenizer,
  12. ValueChanged<T>? onChipTapped,
  13. QueryChanged<T>? onQueryChanged,
  14. OnLostFocus<T>? onLostFocus,
  15. ChipsChanged<T>? onChipsChanged,
  16. int? maxChips,
  17. VoidCallback? onSwipeClosed,
  18. TextInputConfiguration? inputConfiguration,
  19. bool? autofocus,
  20. FocusNode? focusNode,
  21. String? query,
  22. PerformTextInputAction<T>? onInputAction,
  23. bool? hideSuggestionsOverlay,
  24. ChipAction<T>? onSuggestionTap,
  25. ChipsInputController<T>? controller,
  26. 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"));