PopupMenuButton<T> constructor

const PopupMenuButton<T>({
  1. Key? key,
  2. required PopupMenuItemBuilder<T> itemBuilder,
  3. T? initialValue,
  4. VoidCallback? onOpened,
  5. PopupMenuItemSelected<T>? onSelected,
  6. PopupMenuCanceled? onCanceled,
  7. String? tooltip,
  8. double? elevation,
  9. Color? shadowColor,
  10. Color? surfaceTintColor,
  11. EdgeInsetsGeometry padding = const EdgeInsets.all(8.0),
  12. EdgeInsetsGeometry? menuPadding,
  13. Widget? child,
  14. double? splashRadius,
  15. Widget? icon,
  16. double? iconSize,
  17. Offset offset = Offset.zero,
  18. bool enabled = true,
  19. ShapeBorder? shape,
  20. Color? color,
  21. Color? iconColor,
  22. bool? enableFeedback,
  23. BoxConstraints? constraints,
  24. PopupMenuPosition? position,
  25. Clip clipBehavior = Clip.none,
  26. bool useRootNavigator = false,
  27. AnimationStyle? popUpAnimationStyle,
  28. RouteSettings? routeSettings,
  29. ButtonStyle? style,
})

Creates a button that shows a popup menu.

Implementation

const PopupMenuButton({
  super.key,
  required this.itemBuilder,
  this.initialValue,
  this.onOpened,
  this.onSelected,
  this.onCanceled,
  this.tooltip,
  this.elevation,
  this.shadowColor,
  this.surfaceTintColor,
  this.padding = const EdgeInsets.all(8.0),
  this.menuPadding,
  this.child,
  this.splashRadius,
  this.icon,
  this.iconSize,
  this.offset = Offset.zero,
  this.enabled = true,
  this.shape,
  this.color,
  this.iconColor,
  this.enableFeedback,
  this.constraints,
  this.position,
  this.clipBehavior = Clip.none,
  this.useRootNavigator = false,
  this.popUpAnimationStyle,
  this.routeSettings,
  this.style,
}) : assert(
       !(child != null && icon != null),
       'You can only pass [child] or [icon], not both.',
     );