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. BorderRadius? borderRadius,
  15. double? splashRadius,
  16. Widget? icon,
  17. double? iconSize,
  18. Offset offset = Offset.zero,
  19. bool enabled = true,
  20. ShapeBorder? shape,
  21. Color? color,
  22. Color? iconColor,
  23. bool? enableFeedback,
  24. BoxConstraints? constraints,
  25. PopupMenuPosition? position,
  26. Clip clipBehavior = Clip.none,
  27. bool useRootNavigator = false,
  28. AnimationStyle? popUpAnimationStyle,
  29. RouteSettings? routeSettings,
  30. ButtonStyle? style,
  31. bool? requestFocus,
})

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.borderRadius,
  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,
  this.requestFocus,
}) : assert(
       !(child != null && icon != null),
       'You can only pass [child] or [icon], not both.',
     );