CustomDropdown<T> constructor
const
CustomDropdown<T> ({
- Key? key,
- List<
T> ? items, - FutureRequest<
T> ? futureRequest, - T? selectedItem,
- List<
T> ? selectedItems, - bool enableMultiSelection = false,
- bool enabled = true,
- String itemLabel(
- T
- ValueChanged<
T?> ? onChanged, - ValueChanged<
List< ? onListChanged,T> > - String hintText = "Select",
- String searchHintText = "Search...",
- double dropdownHeight = 300,
- BoxDecoration? headerDecoration,
- TextStyle? headerTextStyle,
- BoxDecoration? dropdownDecoration,
- BoxDecoration? selectedItemDecoration,
- TextStyle? listItemStyle,
- TextStyle? selectedListItemStyle,
- EdgeInsetsGeometry? headerPadding,
- EdgeInsetsGeometry? listItemPadding,
- Widget headerBuilder(
- BuildContext context,
- T? selectedItem,
- List<
T> selectedItems
- Widget listItemBuilder(
- BuildContext context,
- T item,
- bool isSelected,
- VoidCallback onTap,
- Widget searchFieldBuilder(
- BuildContext context,
- TextEditingController controller,
- ValueChanged<
String> onSearch
- Widget? noResultFoundWidget,
- Widget? loadingWidget,
- Widget? errorWidget,
- int itemsPerPage = 10,
- Duration searchDebounce = const Duration(milliseconds: 500),
- String doneButtonText = "Done",
- 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",
);