CustomDropdown<T> constructor

const CustomDropdown<T>({
  1. Key? key,
  2. List<T>? items,
  3. FutureRequest<T>? futureRequest,
  4. T? selectedItem,
  5. List<T>? selectedItems,
  6. bool enableMultiSelection = false,
  7. bool enabled = true,
  8. String itemLabel(
    1. T
    )?,
  9. ValueChanged<T?>? onChanged,
  10. ValueChanged<List<T>>? onListChanged,
  11. String hintText = "Select",
  12. String searchHintText = "Search...",
  13. double dropdownHeight = 300,
  14. BoxDecoration? headerDecoration,
  15. TextStyle? headerTextStyle,
  16. BoxDecoration? dropdownDecoration,
  17. BoxDecoration? selectedItemDecoration,
  18. TextStyle? listItemStyle,
  19. TextStyle? selectedListItemStyle,
  20. EdgeInsetsGeometry? headerPadding,
  21. EdgeInsetsGeometry? listItemPadding,
  22. Widget headerBuilder(
    1. BuildContext context,
    2. T? selectedItem,
    3. List<T> selectedItems
    )?,
  23. Widget listItemBuilder(
    1. BuildContext context,
    2. T item,
    3. bool isSelected,
    4. VoidCallback onTap,
    )?,
  24. Widget searchFieldBuilder(
    1. BuildContext context,
    2. TextEditingController controller,
    3. ValueChanged<String> onSearch
    )?,
  25. Widget? noResultFoundWidget,
  26. Widget? loadingWidget,
  27. Widget? errorWidget,
  28. int itemsPerPage = 10,
  29. Duration searchDebounce = const Duration(milliseconds: 500),
  30. String doneButtonText = "Done",
  31. TextStyle? doneButtonStyle,
})

Implementation

const CustomDropdown({
  super.key,
  this.items,
  this.futureRequest,
  this.selectedItem,
  this.selectedItems,
  this.enableMultiSelection = false,
  this.enabled = true,
  this.itemLabel,
  this.onChanged,
  this.onListChanged,
  this.hintText = "Select",
  this.searchHintText = "Search...",
  this.dropdownHeight = 300,
  this.headerDecoration,
  this.headerTextStyle,
  this.dropdownDecoration,
  this.selectedItemDecoration,
  this.listItemStyle,
  this.selectedListItemStyle,
  this.headerPadding,
  this.listItemPadding,
  this.headerBuilder,
  this.listItemBuilder,
  this.searchFieldBuilder,
  this.noResultFoundWidget,
  this.loadingWidget,
  this.errorWidget,
  this.itemsPerPage = 10,
  this.searchDebounce = const Duration(milliseconds: 500),
  this.doneButtonText = "Done",
  this.doneButtonStyle,
}) : assert(
       items != null || futureRequest != null,
       "Either items or futureRequest must be provided",
     );