DropdownButton2<T> constructor
DropdownButton2<T> ({
- Key? key,
- required List<
DropdownMenuItem< ? items,T> > - DropdownButtonBuilder? selectedItemBuilder,
- T? value,
- Widget? hint,
- Widget? disabledHint,
- ValueChanged<
T?> ? onChanged, - int dropdownElevation = 8,
- TextStyle? style,
- Widget? underline,
- Widget? icon,
- Widget? iconOnClick,
- Color? iconDisabledColor,
- Color? iconEnabledColor,
- double iconSize = 24.0,
- bool isDense = false,
- bool isExpanded = false,
- double itemHeight = kMinInteractiveDimension,
- Color? focusColor,
- FocusNode? focusNode,
- bool autofocus = false,
- double? dropdownMaxHeight,
- bool? enableFeedback,
- AlignmentGeometry alignment = AlignmentDirectional.centerStart,
- double? buttonHeight,
- double? buttonWidth,
- EdgeInsetsGeometry? buttonPadding,
- BoxDecoration? buttonDecoration,
- int? buttonElevation,
- EdgeInsetsGeometry? itemPadding,
- double? dropdownWidth,
- EdgeInsetsGeometry? dropdownPadding,
- BoxDecoration? dropdownDecoration,
- Color? selectedItemHighlightColor,
- Radius? scrollbarRadius,
- double? scrollbarThickness,
- bool? scrollbarAlwaysShow,
- Offset? offset,
- Widget? customButton,
- List<
int> ? customItemsIndexes, - double? customItemsHeight,
- bool openWithLongPress = false,
- bool dropdownOverButton = false,
- bool dropdownFullScreen = false,
- void onMenuStateChange(
- bool isOpen
Implementation
DropdownButton2({
Key? key,
required this.items,
this.selectedItemBuilder,
this.value,
this.hint,
this.disabledHint,
this.onChanged,
this.dropdownElevation = 8,
this.style,
this.underline,
this.icon,
this.iconOnClick,
this.iconDisabledColor,
this.iconEnabledColor,
this.iconSize = 24.0,
this.isDense = false,
this.isExpanded = false,
this.itemHeight = kMinInteractiveDimension,
this.focusColor,
this.focusNode,
this.autofocus = false,
this.dropdownMaxHeight,
this.enableFeedback,
this.alignment = AlignmentDirectional.centerStart,
this.buttonHeight,
this.buttonWidth,
this.buttonPadding,
this.buttonDecoration,
this.buttonElevation,
this.itemPadding,
this.dropdownWidth,
this.dropdownPadding,
this.dropdownDecoration,
this.selectedItemHighlightColor,
this.scrollbarRadius,
this.scrollbarThickness,
this.scrollbarAlwaysShow,
this.offset,
this.customButton,
this.customItemsIndexes,
this.customItemsHeight,
this.openWithLongPress = false,
this.dropdownOverButton = false,
this.dropdownFullScreen = false,
this.onMenuStateChange,
// When adding new arguments, consider adding similar arguments to
// DropdownButtonFormField.
}) : assert(
items == null ||
items.isEmpty ||
value == null ||
items.where((DropdownMenuItem<T> item) {
return item.value == value;
}).length ==
1,
"There should be exactly one item with [DropdownButton]'s value: "
'$value. \n'
'Either zero or 2 or more [DropdownMenuItem]s were detected '
'with the same value',
),
_inputDecoration = null,
_isEmpty = false,
super(key: key);