onItemBuilder method

List<PopupMenuEntry<T>> onItemBuilder(
  1. BuildContext context
)

Implementation

List<PopupMenuEntry<T>> onItemBuilder(BuildContext context) {
  List<PopupMenuEntry<T>>? menuOptions;
  // items or onItems()
  final List<T>? options = items ?? onItems();
  if (options != null && options.isNotEmpty) {
    menuOptions = _onItems(options).call(context);
  }
  // menuEntries
  if (menuOptions == null) {
    final entries = menuEntries;
    if (entries != null && entries.isNotEmpty) {
      menuOptions = entries;
    }
  }
  // the getter, menuItems
  if (menuOptions == null && menuItems.isNotEmpty) {
    menuOptions = menuItems;
  }
  // itemBuilder()
  menuOptions ??= itemBuilder == null ? null : itemBuilder!(context);
  return menuOptions ??= <PopupMenuEntry<T>>[];
}