CustomDropdownTCB<T>.multiple constructor

CustomDropdownTCB<T>.multiple({
  1. Key? key,
  2. List<TCBDropdownMenuItem<T>>? items,
  3. Function? onChanged,
  4. List<int> selectedItems = const [],
  5. TextStyle? style,
  6. dynamic searchHint,
  7. dynamic hint,
  8. dynamic disabledHint,
  9. dynamic icon = const Icon(Icons.arrow_drop_down),
  10. dynamic underline,
  11. dynamic doneButton = "Done",
  12. dynamic label,
  13. dynamic closeButton = "Close",
  14. bool displayClearIcon = true,
  15. Icon clearIcon = const Icon(Icons.clear),
  16. Color? iconEnabledColor,
  17. Color? iconDisabledColor,
  18. double iconSize = 24.0,
  19. bool isExpanded = false,
  20. bool isCaseSensitiveSearch = false,
  21. Function? searchFn,
  22. Function? onClear,
  23. Function? selectedValueWidgetFn,
  24. TextInputType keyboardType = TextInputType.text,
  25. Function? validator,
  26. Function? displayItem,
  27. bool dialogBox = true,
  28. BoxConstraints? menuConstraints,
  29. bool readOnly = false,
  30. Color? menuBackgroundColor,
  31. bool rightToLeft = false,
  32. bool autofocus = true,
  33. Function? selectedAggregateWidgetFn,
  34. double padding = 10.0,
  35. Function? setOpenDialog,
  36. Widget buildDropDownDialog(
    1. Widget titleBar,
    2. Widget searchBar,
    3. Widget list,
    4. Widget closeButton,
    5. BuildContext dropDownContext,
    )?,
  37. InputDecoration? searchInputDecoration,
  38. int? itemsPerPage,
  39. PointerThisPlease<int>? currentPage,
  40. Widget customPaginationDisplay(
    1. Widget listWidget,
    2. int totalFilteredItemsNb,
    3. Function updateSearchPage
    )?,
  41. Future<Tuple2<List<TCBDropdownMenuItem>, int>> futureSearchFn(
    1. String? keyword,
    2. String? orderBy,
    3. bool? orderAsc,
    4. List<Tuple2<String, String>>? filters,
    5. int? pageNb,
    )?,
  42. Map<String, Map<String, dynamic>>? futureSearchOrderOptions,
  43. Map<String, Map<String, Object>>? futureSearchFilterOptions,
  44. List<T>? futureSelectedValues,
  45. dynamic emptyListWidget,
  46. Function? onTap,
})

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.

  • items with child: Widget displayed ; value: any object with .toString() used to match search keyword.
  • onChanged Function with parameter: selectedItems not returning executed after the selection is done.
  • selectedItems indexes of items to be preselected.
  • style used for the hint if it is given is String.
  • searchHint String|Widget|Function with no parameter returning String|Widget displayed at the top of the search dialog box.
  • hint String|Widget|Function with no parameter returning String|Widget displayed before any value is selected or after the selection is cleared.
  • disabledHint String|Widget|Function with no parameter returning String|Widget displayed instead of hint when the widget is displayed.
  • icon String|Widget|Function with parameter: selectedItems returning String|Widget displayed next to the selected items or the hint if none.
  • underline String|Widget|Function with parameter: selectedItems returning String|Widget displayed below the selected items or the hint if none.
  • 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.
  • label String|Widget|Function with parameter: selectedItems returning String|Widget displayed above the selected items or the hint if none.
  • closeButton String|Widget|Function with parameter: selectedItems returning String|Widget displayed at the bottom of the search dialog box.
  • displayClearIcon whether or not to display an icon to clear the selected values.
  • clearIcon Icon to be used for clearing the selected values.
  • iconEnabledColor Color to be used for enabled icons.
  • iconDisabledColor Color to be used for disabled icons.
  • iconSize for the icons next to the selected values (icon and clearIcon).
  • isExpanded can be necessary to avoid pixel overflows (zebra symptom).
  • isCaseSensitiveSearch only used when searchFn is not specified.
  • searchFn Function with parameters: keyword, items returning List<int> as the list of indexes for the items to be displayed.
  • onClear Function with no parameter not returning executed when the clear icon is tapped.
  • selectedValueWidgetFn Function with parameter: item returning Widget to be used to display the selected values.
  • keyboardType used for the search.
  • validator Function with parameter: selectedItems returning String displayed below selected values when not valid and null when valid.
  • displayItem Function with parameters: item, selected returning Widget to be displayed in the search list.
  • dialogBox whether the search should be displayed as a dialog box or as a menu below the selected values if any.
  • 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.
  • readOnly bool whether to let the user choose the value to select or just present the selected value if any.
  • menuBackgroundColor Color background color of the menu whether in dialog box or menu mode.
  • rightToLeft bool mirrors the widgets display for right to left languages defaulted to false.
  • autofocus bool automatically focuses on the search field bringing up the keyboard defaulted to true.
  • selectedAggregateWidgetFn Function with parameter: list of widgets presenting selected values , returning Widget to be displayed to present the selected items.
  • padding double sets the padding around the DropdownButton, defaulted to 10.0.
  • setOpenDialog Function sets the function to call to set the function to call in order to open the dialog with the search terms string as a parameter, defaulted to null.
  • buildDropDownDialog Function controls the layout of the dropdown dialog.
  • searchInputDecoration InputDecoration sets the search bar decoration.
  • itemsPerPage int if set, organizes the search list per page with the given number of items displayed per page.
  • currentPage int if itemsPerPage is set, holds the page number for the search items to be displayed.
  • customPaginationDisplay Widget Function(Widget listWidget, int totalFilteredItemsNb, Function updateSearchPage) if itemsPerPage is set, customizes the display and the handling of the pagination on the search list.
  • futureSearchFn Future<int> Function(String keyword, List<TCBDropdownMenuItem> itemsListToClearAndFill, int pageNb) used to search items from the network. Must return items (up to itemsPerPage if set). Must return an int with the total number of results (allows the handling of pagination).
  • futureSearchOrderOptions Map<String, Map<String,dynamic>> when futureSearchFn is set, can be used to display search order options specified in the form {"order1Name":{"icon":order1IconWidget,"asc":true},}. Please refer to the documentation example: https://github.com/lcuis/search_choices/blob/master/example/lib/main.dart.
  • futureSearchFilterOptions Map<String, Map<String, Object>> when futureSearchFn is set, can be used to display search filters specified in the form {"filter1Name": {"icon":filter1IconWidget, "values":["value1",{"value2":filter1Value2Widget}}}. Please refer to the documentation example: https://github.com/lcuis/search_choices/blob/master/example/lib/main.dart.
  • futureSelectedValues List<T> contains the list of selected values in case of future search in multiple selection mode.
  • emptyListWidget String|Widget|Function with parameter: keyword returning String|Widget displayed instead of the list of items in case it is empty.
  • onTap Function called when the user clicks on the Widget before it opens the dialog or the menu. Note that this is not called in case the Widget is disabled.

Implementation

factory CustomDropdownTCB.multiple({
  Key? key,
  List<TCBDropdownMenuItem<T>>? items,
  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,
  bool rightToLeft = false,
  bool autofocus = true,
  Function? selectedAggregateWidgetFn,
  double padding = 10.0,
  Function? setOpenDialog,
  Widget Function(
    Widget titleBar,
    Widget searchBar,
    Widget list,
    Widget closeButton,
    BuildContext dropDownContext,
  )?
      buildDropDownDialog,
  InputDecoration? searchInputDecoration,
  int? itemsPerPage,
  PointerThisPlease<int>? currentPage,
  Widget Function(Widget listWidget, int totalFilteredItemsNb,
          Function updateSearchPage)?
      customPaginationDisplay,
  Future<Tuple2<List<TCBDropdownMenuItem>, int>> Function(
          String? keyword,
          String? orderBy,
          bool? orderAsc,
          List<Tuple2<String, String>>? filters,
          int? pageNb)?
      futureSearchFn,
  Map<String, Map<String, dynamic>>? futureSearchOrderOptions,
  Map<String, Map<String, Object>>? futureSearchFilterOptions,
  List<T>? futureSelectedValues,
  dynamic emptyListWidget,
  Function? onTap,
}) {
  return (CustomDropdownTCB._(
    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,
    rightToLeft: rightToLeft,
    autofocus: autofocus,
    selectedAggregateWidgetFn: selectedAggregateWidgetFn,
    padding: padding,
    setOpenDialog: setOpenDialog,
    buildDropDownDialog: buildDropDownDialog,
    searchInputDecoration: searchInputDecoration,
    itemsPerPage: itemsPerPage,
    currentPage: currentPage,
    customPaginationDisplay: customPaginationDisplay,
    futureSearchFn: futureSearchFn,
    futureSearchOrderOptions: futureSearchOrderOptions,
    futureSearchFilterOptions: futureSearchFilterOptions,
    futureSelectedValues: futureSelectedValues,
    emptyListWidget: emptyListWidget,
    onTap: onTap,
  ));
}