ComboBox<T> constructor

const ComboBox<T>({
  1. Key? key,
  2. required List<ComboBoxItem<T>>? items,
  3. ComboBoxBuilder? selectedItemBuilder,
  4. T? value,
  5. Widget? placeholder,
  6. Widget? disabledPlaceholder,
  7. ValueChanged<T?>? onChanged,
  8. VoidCallback? onTap,
  9. int elevation = 8,
  10. TextStyle? style,
  11. Widget icon = const Icon(FluentIcons.chevron_down),
  12. Color? iconDisabledColor,
  13. Color? iconEnabledColor,
  14. double iconSize = 8.0,
  15. bool isExpanded = false,
  16. Color? focusColor,
  17. FocusNode? focusNode,
  18. bool autofocus = false,
  19. Color? popupColor,
})

Creates a combo box button.

The items must have distinct values. If value isn't null then it must be equal to one of the ComboBoxItem values. If items or onChanged is null, the button will be disabled, the down arrow will be greyed out.

If value is null and the button is enabled, placeholder will be displayed if it is non-null.

If value is null and the button is disabled, disabledPlaceholder will be displayed if it is non-null. If disabledPlaceholder is null, then placeholder will be displayed if it is non-null.

The elevation and iconSize arguments must not be null (they both have defaults, so do not need to be specified). The isExpanded arguments must not be null.

The autofocus argument must not be null.

The popupColor argument specifies the background color of the combo box when it is open. If it is null, the default Acrylic color is used.

Implementation

const ComboBox({
  super.key,
  required this.items,
  this.selectedItemBuilder,
  this.value,
  this.placeholder,
  this.disabledPlaceholder,
  this.onChanged,
  this.onTap,
  this.elevation = 8,
  this.style,
  this.icon = const Icon(FluentIcons.chevron_down),
  this.iconDisabledColor,
  this.iconEnabledColor,
  this.iconSize = 8.0,
  this.isExpanded = false,
  this.focusColor,
  this.focusNode,
  this.autofocus = false,
  this.popupColor,
  // When adding new arguments, consider adding similar arguments to
  // ComboBoxFormField.
});