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. Widget? child,
  13. double? splashRadius,
  14. Widget? icon,
  15. double? iconSize,
  16. Offset offset = Offset.zero,
  17. bool enabled = true,
  18. ShapeBorder? shape,
  19. Color? color,
  20. Color? iconColor,
  21. bool? enableFeedback,
  22. BoxConstraints? constraints,
  23. PopupMenuPosition? position,
  24. Clip clipBehavior = Clip.none,
  25. bool useRootNavigator = false,
  26. AnimationStyle? popUpAnimationStyle}
)

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