DropdownButton<T> constructor

DropdownButton<T>({Key key, @required List<DropdownMenuItem<T>> items, T value, Widget hint, Widget disabledHint, @required ValueChanged<T> onChanged, int elevation: 8, TextStyle style, double iconSize: 24.0, bool isDense: false, bool isExpanded: false })

Creates a dropdown button.

The items must have distinct values and if value isn't null it must be among them. If items or onChanged is null, the button will be disabled, the down arrow will be grayed out, and the disabledHint will be shown (if provided).

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

Implementation

DropdownButton({
  Key key,
  @required this.items,
  this.value,
  this.hint,
  this.disabledHint,
  @required this.onChanged,
  this.elevation = 8,
  this.style,
  this.iconSize = 24.0,
  this.isDense = false,
  this.isExpanded = false,
}) : assert(items == null || value == null || items.where((DropdownMenuItem<T> item) => item.value == value).length == 1),
    super(key: key);