FormBuilderChipsInput<T> constructor Null safety

FormBuilderChipsInput<T>(
  1. {Key? key,
  2. required String name,
  3. FormFieldValidator<List<T>>? validator,
  4. List<T> initialValue = const [],
  5. InputDecoration decoration = const InputDecoration(),
  6. ValueChanged<List<T>?>? onChanged,
  7. ValueTransformer<List<T>?>? valueTransformer,
  8. bool enabled = true,
  9. FormFieldSetter<List<T>>? onSaved,
  10. AutovalidateMode autovalidateMode = AutovalidateMode.disabled,
  11. VoidCallback? onReset,
  12. FocusNode? focusNode,
  13. required ChipsBuilder<T> chipBuilder,
  14. required ChipsBuilder<T> suggestionBuilder,
  15. required ChipsInputSuggestions<T> findSuggestions,
  16. int? maxChips,
  17. TextStyle? textStyle,
  18. String? actionLabel,
  19. double? suggestionsBoxMaxHeight,
  20. bool autocorrect = false,
  21. TextInputAction inputAction = TextInputAction.done,
  22. TextInputType inputType = TextInputType.text,
  23. Brightness keyboardAppearance = Brightness.light,
  24. bool obscureText = false,
  25. TextCapitalization textCapitalization = TextCapitalization.none,
  26. bool allowChipEditing = false,
  27. bool autofocus = false,
  28. TextOverflow textOverflow = TextOverflow.clip}
)

Creates a field that takes a list of Chips as input and suggests more options while typing

Implementation

FormBuilderChipsInput({
  Key? key,
  //From Super
  required String name,
  FormFieldValidator<List<T>>? validator,
  List<T> initialValue = const [],
  InputDecoration decoration = const InputDecoration(),
  ValueChanged<List<T>?>? onChanged,
  ValueTransformer<List<T>?>? valueTransformer,
  bool enabled = true,
  FormFieldSetter<List<T>>? onSaved,
  AutovalidateMode autovalidateMode = AutovalidateMode.disabled,
  VoidCallback? onReset,
  FocusNode? focusNode,
  required this.chipBuilder,
  required this.suggestionBuilder,
  required this.findSuggestions,
  this.maxChips,
  this.textStyle,
  this.actionLabel,
  this.suggestionsBoxMaxHeight,
  this.autocorrect = false,
  this.inputAction = TextInputAction.done,
  this.inputType = TextInputType.text,
  this.keyboardAppearance = Brightness.light,
  this.obscureText = false,
  this.textCapitalization = TextCapitalization.none,
  this.allowChipEditing = false,
  this.autofocus = false,
  this.textOverflow = TextOverflow.clip,
}) : super(
        key: key,
        initialValue: initialValue,
        name: name,
        validator: validator,
        valueTransformer: valueTransformer,
        onChanged: onChanged,
        autovalidateMode: autovalidateMode,
        onSaved: onSaved,
        enabled: enabled,
        onReset: onReset,
        decoration: decoration,
        focusNode: focusNode,
        builder: (FormFieldState<List<T>?> field) {
          final state = field as _FormBuilderChipsInputState<T>;

          return ChipsInput<T>(
            initialValue: field.value!,
            enabled: state.enabled,
            decoration: state.decoration,
            findSuggestions: findSuggestions,
            onChanged: (data) {
              field.didChange(data);
            },
            maxChips: maxChips,
            chipBuilder: chipBuilder,
            suggestionBuilder: suggestionBuilder,
            textStyle: textStyle,
            actionLabel: actionLabel,
            autocorrect: autocorrect,
            inputAction: inputAction,
            inputType: inputType,
            keyboardAppearance: keyboardAppearance,
            obscureText: obscureText,
            suggestionsBoxMaxHeight: suggestionsBoxMaxHeight,
            textCapitalization: textCapitalization,
            allowChipEditing: allowChipEditing,
            autofocus: autofocus,
            focusNode: state.effectiveFocusNode,
            textOverflow: textOverflow,
          );
        },
      );