SearchChoices<T>.multiple constructor

SearchChoices<T>.multiple({
  1. Key? key,
  2. List<DropdownMenuItem<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. String? validator(
    1. T?
    )?,
  26. Function? displayItem,
  27. bool dialogBox = true,
  28. BoxConstraints? menuConstraints,
  29. bool readOnly = false,
  30. Color? menuBackgroundColor,
  31. bool? rightToLeft,
  32. bool autofocus = true,
  33. Function? selectedAggregateWidgetFn,
  34. dynamic padding,
  35. Function? setOpenDialog,
  36. Widget buildDropDownDialog(
    1. Widget titleBar,
    2. Widget searchBar,
    3. Widget list,
    4. Widget closeButton,
    5. BuildContext dropDownContext,
    )?,
  37. EdgeInsets? dropDownDialogPadding,
  38. InputDecoration? searchInputDecoration,
  39. int? itemsPerPage,
  40. PointerThisPlease<int>? currentPage,
  41. Widget customPaginationDisplay(
    1. Widget listWidget,
    2. int totalFilteredItemsNb,
    3. Function updateSearchPage
    )?,
  42. Future<Tuple2<List<DropdownMenuItem>, int>> futureSearchFn(
    1. String? keyword,
    2. String? orderBy,
    3. bool? orderAsc,
    4. List<Tuple2<String, String>>? filters,
    5. int? pageNb,
    )?,
  43. Map<String, Map<String, dynamic>>? futureSearchOrderOptions,
  44. Map<String, Map<String, Object>>? futureSearchFilterOptions,
  45. List<T>? futureSelectedValues,
  46. dynamic emptyListWidget,
  47. Function? onTap,
  48. Function? futureSearchRetryButton,
  49. int? searchDelay,
  50. Widget fieldPresentationFn(
    1. Widget fieldWidget, {
    2. bool selectionIsValid,
    })?,
  51. Decoration? fieldDecoration,
  52. Widget? clearSearchIcon,
  53. Future<void> showDialogFn(
    1. BuildContext context,
    2. Widget menuWidget({
      1. String searchTerms,
      }),
    3. String searchTerms
    )?,
  54. FormFieldSetter<T>? onSaved,
  55. String? listValidator(
    1. List<T?>
    )?,
  56. AutovalidateMode autovalidateMode = AutovalidateMode.onUserInteraction,
  57. String? restorationId,
  58. dynamic giveMeThePop(
    1. Function pop
    )?,
  59. Widget buildFutureFilterOrOrderButton({
    1. required BuildContext context,
    2. required bool filter,
    3. int? nbFilters,
    4. required Function onPressed,
    5. bool? orderAsc,
    6. String? orderBy,
    })?,
  60. Widget searchResultDisplayFn({
    1. required Widget displayItem(
      1. DropdownMenuItem item,
      2. bool isItemSelected
      ),
    2. required Widget emptyListWidget,
    3. required void itemTapped(
      1. int index,
      2. T value,
      3. bool itemSelected
      ),
    4. required List<Tuple3<int, DropdownMenuItem, bool>> itemsToDisplay,
    5. required ScrollController scrollController,
    6. required bool thumbVisibility,
    })?,
})

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.

Implementation

SearchChoices.multiple({
  Key? key,
  this.items,
  this.onChanged,
  this.selectedItems = const [],
  this.style,
  this.searchHint,
  this.hint,
  this.disabledHint,
  this.icon = const Icon(Icons.arrow_drop_down),
  this.underline,
  this.doneButton = "Done",
  this.label,
  this.closeButton = "Close",
  this.displayClearIcon = true,
  this.clearIcon = const Icon(Icons.clear),
  this.iconEnabledColor,
  this.iconDisabledColor,
  this.iconSize = 24.0,
  this.isExpanded = false,
  this.isCaseSensitiveSearch = false,
  this.searchFn,
  this.onClear,
  this.selectedValueWidgetFn,
  this.keyboardType = TextInputType.text,
  this.validator,
  this.displayItem,
  this.dialogBox = true,
  this.menuConstraints,
  this.readOnly = false,
  this.menuBackgroundColor,
  this.rightToLeft,
  this.autofocus = true,
  this.selectedAggregateWidgetFn,
  this.padding,
  this.setOpenDialog,
  this.buildDropDownDialog,
  this.dropDownDialogPadding,
  this.searchInputDecoration,
  this.itemsPerPage,
  this.currentPage,
  this.customPaginationDisplay,
  this.futureSearchFn,
  this.futureSearchOrderOptions,
  this.futureSearchFilterOptions,
  this.futureSelectedValues,
  this.emptyListWidget,
  this.onTap,
  this.futureSearchRetryButton,
  this.searchDelay,
  this.fieldPresentationFn,
  this.fieldDecoration,
  this.clearSearchIcon,
  this.showDialogFn,
  this.onSaved,
  this.listValidator,
  this.autovalidateMode = AutovalidateMode.onUserInteraction,
  this.restorationId,
  this.giveMeThePop,
  this.buildFutureFilterOrOrderButton,
  this.searchResultDisplayFn,
})  : multipleSelection = true,
      value = null,
      super(
        key: key,
        builder: (FormFieldState<dynamic> state) {
          _SearchChoicesState<T> sCState = state as _SearchChoicesState<T>;
          return (sCState.buildWidget(sCState.context));
        },
        onSaved: onSaved,
        validator: validator,
        initialValue: null,
        enabled: (items?.isNotEmpty ?? false || futureSearchFn != null) &&
            (onChanged != null || onChanged is Function),
        autovalidateMode: autovalidateMode,
        restorationId: restorationId,
      ) {
  checkPreconditions();
}