showItemPicker<T> function
Future<T?>
showItemPicker<T>(
- BuildContext context, {
- required ItemChildDelegate<
T> items, - required ItemPickerBuilder<
T> builder, - T? initialValue,
- ItemPickerLayout layout = const GridItemPickerLayout(),
- AlignmentGeometry? alignment,
- AlignmentGeometry? anchorAlignment,
- BoxConstraints? constraints,
- Offset? offset,
- Widget? title,
Implementation
Future<T?> showItemPicker<T>(
BuildContext context, {
required ItemChildDelegate<T> items,
required ItemPickerBuilder<T> builder,
T? initialValue,
ItemPickerLayout layout = const GridItemPickerLayout(),
AlignmentGeometry? alignment,
AlignmentGeometry? anchorAlignment,
BoxConstraints? constraints,
Offset? offset,
Widget? title,
}) {
final theme = Theme.of(context);
return showPopover<T>(
context: context,
alignment: alignment ?? AlignmentDirectional.topStart,
anchorAlignment: anchorAlignment ?? AlignmentDirectional.bottomStart,
offset: offset ?? Offset(0, 8.0 * theme.scaling),
builder: (context) {
return SurfaceCard(
padding: EdgeInsets.zero,
child: _InternalItemPicker<T>(
items: items,
builder: builder,
initialValue: initialValue,
layout: layout,
title: title,
constraints: constraints,
onChanged: (value) {
closeOverlay(context, value);
},
),
);
},
).future;
}