SearchableDropdown<T>.multiple constructor
- Key? key,
- @required List<
DropdownMenuItem< ? items,T> > - @required Function? onChanged,
- List<
int> ? selectedItems = const [], - TextStyle? style,
- dynamic searchHint,
- dynamic hint,
- dynamic disabledHint,
- dynamic icon = const Icon(Icons.arrow_drop_down),
- dynamic underline,
- dynamic doneButton = "Done",
- dynamic label,
- dynamic closeButton = "Close",
- bool displayClearIcon = true,
- Icon clearIcon = const Icon(Icons.clear),
- Color? iconEnabledColor,
- Color? iconDisabledColor,
- double iconSize = 24.0,
- bool isExpanded = false,
- bool isCaseSensitiveSearch = false,
- Function? searchFn,
- Function? onClear,
- Function? selectedValueWidgetFn,
- TextInputType keyboardType = TextInputType.text,
- Function? validator,
- Function? displayItem,
- bool dialogBox = true,
- bool readOnly = false,
Search choices Widget with a multiple choice that opens a dialog or a menu to let the user do the selection conveniently with a search.
@param items with child: Widget displayed ; value: any object with .toString() used to match search keyword. @param onChanged Function with parameter: selectedItems not returning executed after the selection is done. @param selectedItems indexes of items to be preselected. @param style used for the hint if it is given is String. @param searchHint String|Widget|Function with no parameter returning String|Widget displayed at the top of the search dialog box. @param hint String|Widget|Function with no parameter returning String|Widget displayed before any value is selected or after the selection is cleared. @param disabledHint String|Widget|Function with no parameter returning String|Widget displayed instead of hint when the widget is displayed. @param icon String|Widget|Function with parameter: selectedItems returning String|Widget displayed next to the selected items or the hint if none. @param underline String|Widget|Function with parameter: selectedItems returning String|Widget displayed below the selected items or the hint if none. @param doneButton String|Widget|Function with parameter: selectedItems returning String|Widget displayed at the top of the search dialog box. Cannot be null in multiple selection mode. @param label String|Widget|Function with parameter: selectedItems returning String|Widget displayed above the selected items or the hint if none. @param closeButton String|Widget|Function with parameter: selectedItems returning String|Widget displayed at the bottom of the search dialog box. @param displayClearIcon whether or not to display an icon to clear the selected values. @param clearIcon Icon to be used for clearing the selected values. @param iconEnabledColor Color to be used for enabled icons. @param iconDisabledColor Color to be used for disabled icons. @param iconSize for the icons next to the selected values (icon and clearIcon). @param isExpanded can be necessary to avoid pixel overflows (zebra symptom). @param isCaseSensitiveSearch only used when searchFn is not specified. @param searchFn Function with parameters: keyword, items returning List<int> as the list of indexes for the items to be displayed. @param onClear Function with no parameter not returning executed when the clear icon is tapped. @param selectedValueWidgetFn Function with parameter: item returning Widget to be used to display the selected values. @param keyboardType used for the search. @param validator Function with parameter: selectedItems returning String displayed below selected values when not valid and null when valid. @param displayItem Function with parameters: item, selected returning Widget to be displayed in the search list. @param dialogBox whether the search should be displayed as a dialog box or as a menu below the selected values if any. @param menuConstraints BoxConstraints used to define the zone where to display the search menu. Example: BoxConstraints.tight(Size.fromHeight(250)) . Not to be used for dialogBox = true. @param readOnly bool whether to let the user choose the value to select or just present the selected value if any. @param menuBackgroundColor Color background color of the menu whether in dialog box or menu mode.
Implementation
factory SearchableDropdown.multiple({
Key? key,
@required List<DropdownMenuItem<T>>? items,
@required Function? onChanged,
List<int>? selectedItems = const [],
TextStyle? style,
dynamic searchHint,
dynamic hint,
dynamic disabledHint,
dynamic icon = const Icon(Icons.arrow_drop_down),
dynamic underline,
dynamic doneButton = "Done",
dynamic label,
dynamic closeButton = "Close",
bool displayClearIcon = true,
Icon clearIcon = const Icon(Icons.clear),
Color? iconEnabledColor,
Color? iconDisabledColor,
double iconSize = 24.0,
bool isExpanded = false,
bool isCaseSensitiveSearch = false,
Function? searchFn,
Function? onClear,
Function? selectedValueWidgetFn,
TextInputType keyboardType = TextInputType.text,
Function? validator,
Function? displayItem,
bool dialogBox = true,
BoxConstraints? menuConstraints,
bool readOnly = false,
Color? menuBackgroundColor,
}) {
return (SearchableDropdown._(
key: key,
items: items!,
style: style,
searchHint: searchHint,
hint: hint,
disabledHint: disabledHint,
icon: icon,
underline: underline,
iconEnabledColor: iconEnabledColor,
iconDisabledColor: iconDisabledColor,
iconSize: iconSize,
isExpanded: isExpanded,
isCaseSensitiveSearch: isCaseSensitiveSearch,
closeButton: closeButton,
displayClearIcon: displayClearIcon,
clearIcon: clearIcon,
onClear: onClear,
selectedValueWidgetFn: selectedValueWidgetFn,
keyboardType: keyboardType,
validator: validator,
label: label,
searchFn: searchFn,
multipleSelection: true,
selectedItems: selectedItems!,
doneButton: doneButton,
onChanged: onChanged,
displayItem: displayItem,
dialogBox: dialogBox,
menuConstraints: menuConstraints,
readOnly: readOnly,
menuBackgroundColor: menuBackgroundColor,
));
}