SearchField<T> constructor
SearchField<T> ({
- Key? key,
- required List<
SearchFieldListItem< suggestions,T> > - Duration animationDuration = const Duration(milliseconds: 300),
- bool autoCorrect = true,
- bool autofocus = false,
- AutovalidateMode? autovalidateMode,
- TextEditingController? controller,
- Widget emptyWidget = const SizedBox(),
- bool? enabled,
- FocusNode? focusNode,
- String? hint,
- SearchFieldListItem<
T> ? initialValue, - List<
TextInputFormatter> ? inputFormatters, - TextInputType? inputType,
- double itemHeight = 35.0,
- Color? marginColor,
- int maxSuggestionsInViewPort = 5,
- bool readOnly = false,
- List<
SearchFieldListItem< ? onSearchTextChanged()?,T> > - void onSaved()?,
- void onScroll()?,
- void onTap()?,
- dynamic onSubmit()?,
- void onTapOutside()?,
- Offset? offset,
- dynamic onSuggestionTap()?,
- InputDecoration? searchInputDecoration,
- TextStyle? searchStyle,
- ScrollbarDecoration? scrollbarDecoration,
- bool showEmpty = false,
- TextStyle? suggestionStyle,
- SuggestionDecoration? suggestionsDecoration,
- SuggestionDirection suggestionDirection = SuggestionDirection.down,
- Suggestion suggestionState = Suggestion.expand,
- BoxDecoration? suggestionItemDecoration,
- SuggestionAction? suggestionAction,
- TextAlign textAlign = TextAlign.start,
- TextCapitalization textCapitalization = TextCapitalization.none,
- TextInputAction? textInputAction,
- String? validator()?,
Implementation
SearchField({
Key? key,
required this.suggestions,
this.animationDuration = const Duration(milliseconds: 300),
this.autoCorrect = true,
this.autofocus = false,
this.autovalidateMode,
this.controller,
this.emptyWidget = const SizedBox(),
this.enabled,
this.focusNode,
this.hint,
this.initialValue,
this.inputFormatters,
this.inputType,
this.itemHeight = 35.0,
this.marginColor,
this.maxSuggestionsInViewPort = 5,
this.readOnly = false,
this.onSearchTextChanged,
this.onSaved,
this.onScroll,
this.onTap,
this.onSubmit,
this.onTapOutside,
this.offset,
this.onSuggestionTap,
this.searchInputDecoration,
this.searchStyle,
this.scrollbarDecoration,
this.showEmpty = false,
this.suggestionStyle,
this.suggestionsDecoration,
this.suggestionDirection = SuggestionDirection.down,
this.suggestionState = Suggestion.expand,
this.suggestionItemDecoration,
this.suggestionAction,
this.textAlign = TextAlign.start,
this.textCapitalization = TextCapitalization.none,
this.textInputAction,
this.validator,
}) : assert(
(initialValue != null &&
suggestions.containsObject(initialValue)) ||
initialValue == null,
'Initial value should either be null or should be present in suggestions list.'),
super(key: key);