BaseSearchField<T extends Object> class

A base search field widget with customizable options.

Inheritance

Constructors

BaseSearchField.new({required String? labelText, required FutureOr<Iterable<T>> optionsBuilder(TextEditingValue), required Widget item(T element)?, required void onChanged(String text)?, required void onSelected(T)?, required String getItemText(T value)?, ButtonStyle? itemStyle, List<T>? unenabledList = const [], double menuMaxHeight = 400, EdgeInsets menuMargin = const EdgeInsets.only(top: 4, bottom: 8), EdgeInsets listPadding = const EdgeInsets.symmetric(vertical: 16), double? itemsSpace, BoxDecoration? menuDecoration, Clip listClipBehavior = Clip.hardEdge, Icon fieldActiveIcon = const Icon(Icons.close), Icon fieldInactiveIcon = const Icon(Icons.arrow_drop_down), Key? textFieldKey, bool? isRequired, String displayStringForOption(T value)?, Key? key, bool? showErrorText, String? errorText, TextEditingController? controller, FocusNode? focusNode, Icon? unfocusSuffixIcon, double? suffixIconPadding, int? errorMaxLines, String? description, TextStyle? textStyle, Widget? fieldSuffixIcon, Widget customTextField({required TextEditingController controller, required FocusNode focusNode, required GlobalKey<State<StatefulWidget>> key, required void onChanged(String)?, required void onSubmitted(String)?, required Widget suffixIcon, required Key? textFieldKey})?, Widget menuList({required Widget item(int index), required int length})?, Widget listButtonItem({required int index, required bool isEnabled, required Key? key, required void onPressed(), required T value})?, InputDecoration? fieldDecoration, bool useFindChildIndexCallback = true, bool usePrototype = true, List<TextInputFormatter>? fieldInputFormatters, TextStyle? labelTextStyle, OptionsViewOpenDirection optionsViewOpenDirection = OptionsViewOpenDirection.down, TextEditingValue? initValue, void onFieldSubmitted(String)?, Key? listKey, Key? listItemKey, double? listCacheExtent, bool listAddSemanticIndexes = true, ScrollController? listController, String? listRestorationId, int? listSemanticChildCount, DragStartBehavior listDragStartBehavior = DragStartBehavior.start, ScrollPhysics? listPhysics, bool? listPrimary, Key? fieldIconKey})
const

Properties

controller TextEditingController?
Controller for the search field
final
customTextField Widget Function({required TextEditingController controller, required FocusNode focusNode, required GlobalKey<State<StatefulWidget>> key, required void onChanged(String)?, required void onSubmitted(String)?, required Widget suffixIcon, required Key? textFieldKey})?
Custom text field widget
final
description String?
Description for the search field
final
displayStringForOption String Function(T value)?
Function to get the display string for the selected item
final
errorMaxLines int?
Maximum lines for the error text
final
errorText String?
Error text for the search field
final
fieldActiveIcon Icon
Active icon for the search field
final
fieldDecoration InputDecoration?
Decoration for the search field
final
fieldIconKey Key?
final
fieldInactiveIcon Icon
Inactive icon for the search field
final
fieldInputFormatters List<TextInputFormatter>?
Input formatters for the search field
final
fieldSuffixIcon Widget?
Suffix icon for the search field
final
focusNode FocusNode?
Focus node for the search field
final
getItemText String Function(T value)?
final
hashCode int
The hash code for this object.
no setterinherited
initValue TextEditingValue?
Initial value for the search field
final
isRequired bool?
Whether the search field is required
final
item Widget Function(T element)?
Widget to display each item
final
itemsSpace double?
Space between items in the list
final
itemStyle ButtonStyle?
Style for the items
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
labelText String?
Label text for the search field
final
labelTextStyle TextStyle?
Style for the label text
final
listAddSemanticIndexes bool
final
listButtonItem Widget Function({required int index, required bool isEnabled, required Key? key, required void onPressed(), required T value})?
Custom list item widget
final
listCacheExtent double?
final
listClipBehavior Clip
Clip behavior for the list
final
listController ScrollController?
final
listDragStartBehavior DragStartBehavior
final
listItemKey Key?
final
listKey Key?
final
listPadding EdgeInsets
Padding for the list inside the menu
final
listPhysics ScrollPhysics?
final
listPrimary bool?
final
listRestorationId String?
final
listSemanticChildCount int?
final
Decoration for the menu
final
Custom list widget
final
Margin for the menu
final
Maximum height for the menu
final
onChanged → void Function(String text)?
Callback for text change
final
onFieldSubmitted → void Function(String)?
Callback for field submission
final
onSelected → void Function(T)?
Callback for item selection
final
optionsBuilder FutureOr<Iterable<T>> Function(TextEditingValue)
Options builder for the search field
final
optionsViewOpenDirection OptionsViewOpenDirection
Direction for the options view
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
showErrorText bool?
Whether to show the error text
final
suffixIconPadding double?
Padding for the suffix icon
final
textFieldKey Key?
Key for the text field
final
textStyle TextStyle?
Text style for the search field
final
unenabledList List<T>?
List of unenabled items
final
unfocusSuffixIcon Icon?
Suffix icon when the field is unfocused
final
useFindChildIndexCallback bool
Whether to use the find child index callback
final
usePrototype bool
Whether to use the prototype
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() State<BaseSearchField<T>>
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