PopupMenuButton<T> constructor
- Key? key,
- required PopupMenuItemBuilder<
T> itemBuilder, - T? initialValue,
- VoidCallback? onOpened,
- PopupMenuItemSelected<
T> ? onSelected, - PopupMenuCanceled? onCanceled,
- String? tooltip,
- double? elevation,
- Color? shadowColor,
- Color? surfaceTintColor,
- EdgeInsetsGeometry padding = const EdgeInsets.all(8.0),
- Widget? child,
- BorderRadius? borderRadius,
- double? splashRadius,
- Widget? icon,
- double? iconSize,
- Offset offset = Offset.zero,
- bool enabled = true,
- ShapeBorder? shape,
- Color? color,
- Color? iconColor,
- bool? enableFeedback,
- BoxConstraints? constraints,
- PopupMenuPosition? position,
- Clip clipBehavior = Clip.none,
- AnimationStyle? popUpAnimationStyle,
- RouteSettings? routeSettings,
- ButtonStyle? style,
- 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.',
);