ItemPicker<T> constructor

const ItemPicker<T>({
  1. Key? key,
  2. required ItemChildDelegate<T> items,
  3. required ItemPickerBuilder<T> builder,
  4. T? value,
  5. ValueChanged<T?>? onChanged,
  6. ItemPickerLayout? layout,
  7. Widget? placeholder,
  8. Widget? title,
  9. PromptMode? mode,
  10. BoxConstraints? constraints,
})

Creates an ItemPicker.

The items delegate provides the selectable items, and the builder function determines how each item is visually represented. Various options control the picker's layout and presentation style.

Parameters:

  • items (ItemChildDelegate
  • builder (ItemPickerBuilder
  • value (T?, optional): Currently selected item
  • onChanged (ValueChanged<T?>?, optional): Callback for selection changes
  • layout (ItemPickerLayout?, optional): Arrangement style for items
  • placeholder (Widget?, optional): Content shown when no item is selected
  • title (Widget?, optional): Title for the picker interface
  • mode (PromptMode?, optional): Presentation style (dialog or popover)
  • constraints (BoxConstraints?, optional): Size constraints for the picker

Example:

ItemPicker<IconData>(
  items: ItemList([Icons.home, Icons.star, Icons.favorite]),
  layout: ItemPickerLayout.grid,
  mode: PromptMode.dialog,
  builder: (context, icon, selected) => Icon(icon),
  onChanged: (icon) => updateIcon(icon),
);

Implementation

const ItemPicker({
  super.key,
  required this.items,
  required this.builder,
  this.value,
  this.onChanged,
  this.layout,
  this.placeholder,
  this.title,
  this.mode,
  this.constraints,
});