popLabelValues<T> method
Widget
popLabelValues<T>({})
Implementation
Widget popLabelValues<T>({
List<LabelValue<T>>? items,
List<LabelValue<T>> Function(BuildContext)? builder,
Widget Function(LabelValue<T>)? display,
required void Function(LabelValue<T>) callback,
LabelValue<T>? initialValue,
T? value,
}) {
return PopupMenuButton<LabelValue<T>>(
child: this,
onSelected: (e) => callback(e),
position: PopupMenuPosition.under,
initialValue: initialValue ?? items?.firstOr((e) => e.value == value),
itemBuilder: (BuildContext c) {
List<LabelValue<T>> ls = builder?.call(c) ?? items ?? [];
return ls.mapList((e) => PopupMenuItem<LabelValue<T>>(value: e, child: display?.call(e) ?? e.label.text()));
},
);
}