CustomDropdown<T> constructor

const CustomDropdown<T>({
  1. Key? key,
  2. required Widget itemBuilder(
    1. BuildContext,
    2. T item
    ),
  3. List<T>? items,
  4. List<DropdownMenuEntry<T>>? dropdownMenuEntries,
  5. T? initialSelection,
  6. ValueChanged<T?>? onSelected,
  7. bool enabled = true,
  8. bool enableFilter = false,
  9. bool enableSearch = true,
  10. TextEditingController? controller,
  11. TextStyle? textStyle,
  12. Object? inputDecorationTheme,
  13. MenuStyle? menuStyle,
  14. Widget? leadingIcon,
  15. Widget? trailingIcon,
  16. bool showTrailingIcon = true,
  17. FocusNode? trailingIconFocusNode,
  18. Widget? selectedTrailingIcon,
  19. Widget? label,
  20. String? hintText,
  21. String? helperText,
  22. String? errorText,
  23. TextInputType? keyboardType,
  24. TextAlign textAlign = TextAlign.start,
  25. EdgeInsetsGeometry? expandedInsets,
  26. FilterCallback<T>? filterCallback,
  27. SearchCallback<T>? searchCallback,
  28. Offset? alignmentOffset,
  29. List<TextInputFormatter>? inputFormatters,
  30. DropdownMenuCloseBehavior closeBehavior = DropdownMenuCloseBehavior.all,
  31. int? maxLines = 1,
  32. TextInputAction? textInputAction,
  33. double? cursorHeight,
  34. String? restorationId,
  35. MenuController? menuController,
  36. bool? requestFocusOnTap,
  37. Widget selectedBuilder(
    1. BuildContext,
    2. T?
    )?,
  38. String? validationMessage,
  39. TextStyle? validationTextStyle,
  40. double? width,
  41. double? menuHeight,
  42. Widget? prefixIcon,
  43. Widget? suffixIcon,
  44. double? borderRadius,
  45. Color? menuBackgroundColor,
  46. double? menuElevation,
})

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.',
      );