ItemPicker<T> constructor
const
ItemPicker<T> ({
- Key? key,
- required ItemChildDelegate<
T> items, - required ItemPickerBuilder<
T> builder, - T? value,
- ValueChanged<
T?> ? onChanged, - ItemPickerLayout? layout,
- Widget? placeholder,
- Widget? title,
- PromptMode? mode,
- 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(ItemChildDelegatebuilder(ItemPickerBuildervalue(T?, optional): Currently selected itemonChanged(ValueChanged<T?>?, optional): Callback for selection changeslayout(ItemPickerLayout?, optional): Arrangement style for itemsplaceholder(Widget?, optional): Content shown when no item is selectedtitle(Widget?, optional): Title for the picker interfacemode(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,
});