popupMenu<T> static method
Widget
popupMenu<T>(
- BuildContext context,
- List<
T> items, - PopupMenuItemSelected<
T> onSelect, - Widget child,
- IndexedWidgetBuilder itemBuilder, {
- double? offsetY,
- double? height,
- double? itemWidth,
- EdgeInsets? padding,
- PopupMenuPosition? position,
- Color? bgColor,
Implementation
static Widget popupMenu <T>(BuildContext context, List<T> items,
PopupMenuItemSelected<T> onSelect, Widget child, IndexedWidgetBuilder itemBuilder, {double? offsetY,
double? height, double? itemWidth, EdgeInsets? padding, PopupMenuPosition? position,
Color? bgColor} ){
return PopupMenuButton<T>(
position: position ?? PopupMenuPosition.under,
constraints: BoxConstraints(
minWidth: itemWidth ?? 120,
maxWidth: itemWidth ?? 120,
),
padding: EdgeInsets.zero,
surfaceTintColor: bgColor ?? Theme.of(context).dialogBackgroundColor,
shadowColor: bgColor ?? Theme.of(context).dialogBackgroundColor,
offset: Offset(0, offsetY??0),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(5),
),
color: bgColor ?? Theme.of(context).dialogBackgroundColor,
onSelected: onSelect,
itemBuilder: (builder) => items.map((e) => PopupMenuItem<T>(
padding: EdgeInsets.zero,
height: height ?? 36,
value: e!,
child: itemBuilder(context, items.indexOf(e)),
)).toList() ,child: child,);
}