CustomDropdown<T> constructor
const
CustomDropdown<T> ({
- Key? key,
- required Widget itemBuilder(
- BuildContext,
- T item
- List<
T> ? items, - List<
DropdownMenuEntry< ? dropdownMenuEntries,T> > - T? initialSelection,
- ValueChanged<
T?> ? onSelected, - bool enabled = true,
- bool enableFilter = false,
- bool enableSearch = true,
- TextEditingController? controller,
- TextStyle? textStyle,
- Object? inputDecorationTheme,
- Widget? leadingIcon,
- Widget? trailingIcon,
- bool showTrailingIcon = true,
- FocusNode? trailingIconFocusNode,
- Widget? selectedTrailingIcon,
- Widget? label,
- String? hintText,
- String? helperText,
- String? errorText,
- TextInputType? keyboardType,
- TextAlign textAlign = TextAlign.start,
- EdgeInsetsGeometry? expandedInsets,
- FilterCallback<
T> ? filterCallback, - SearchCallback<
T> ? searchCallback, - Offset? alignmentOffset,
- List<
TextInputFormatter> ? inputFormatters, - DropdownMenuCloseBehavior closeBehavior = DropdownMenuCloseBehavior.all,
- int? maxLines = 1,
- TextInputAction? textInputAction,
- double? cursorHeight,
- String? restorationId,
- bool? requestFocusOnTap,
- Widget selectedBuilder(
- BuildContext,
- T?
- String? validationMessage,
- TextStyle? validationTextStyle,
- double? width,
- Widget? prefixIcon,
- Widget? suffixIcon,
- double? borderRadius,
Implementation
const CustomDropdown({
super.key,
required this.itemBuilder,
this.items,
this.dropdownMenuEntries,
this.initialSelection,
this.onSelected,
this.enabled = true,
this.enableFilter = false,
this.enableSearch = true,
this.controller,
this.textStyle,
this.inputDecorationTheme,
this.menuStyle,
this.leadingIcon,
this.trailingIcon,
this.showTrailingIcon = true,
this.trailingIconFocusNode,
this.selectedTrailingIcon,
this.label,
this.hintText,
this.helperText,
this.errorText,
this.keyboardType,
this.textAlign = TextAlign.start,
this.expandedInsets,
this.filterCallback,
this.searchCallback,
this.alignmentOffset,
this.inputFormatters,
this.closeBehavior = DropdownMenuCloseBehavior.all,
this.maxLines = 1,
this.textInputAction,
this.cursorHeight,
this.restorationId,
this.menuController,
this.requestFocusOnTap,
this.selectedBuilder,
this.validationMessage,
this.validationTextStyle,
this.width,
this.menuHeight,
this.prefixIcon,
this.suffixIcon,
this.borderRadius,
this.menuBackgroundColor,
this.menuElevation,
}) : assert(
dropdownMenuEntries != null || items != null,
'Either dropdownMenuEntries or items must be provided.',
);