FContextMenu constructor
FContextMenu({
- FPopoverControl control = const .managed(),
- FPopoverMenuStyleDelta style = const .context(),
- ScrollController? scrollController,
- ScrollCacheExtent? scrollCacheExtent,
- double maxHeight = .infinity,
- bool intrinsicWidth = true,
- DragStartBehavior dragStartBehavior = .start,
- FItemDivider divider = .full,
- double spacing = 0,
- FPortalOverflow overflow = .flip,
- bool useViewPadding = true,
- bool useViewInsets = true,
- Offset offset = .zero,
- Object? groupId,
- FPopoverHideRegion hideRegion = .excludeChild,
- VoidCallback? onTapHide,
- String? barrierSemanticsLabel,
- bool barrierSemanticsDismissible = true,
- bool cutout = false,
- void cutoutBuilder() = FModalBarrier.defaultCutoutBuilder,
- String? semanticsLabel,
- bool? autofocus,
- FocusScopeNode? focusNode,
- ValueChanged<
bool> ? onFocusChange, - TraversalEdgeBehavior? traversalEdgeBehavior,
- bool? faded,
- bool? longPress,
- bool? secondaryPress,
- ValueWidgetBuilder<
FPopoverController> builder = FPopover.defaultBuilder, - Widget? child,
- Key? key,
Creates a context menu of FItems.
Contract
Throws AssertionError if neither menuBuilder nor menu is provided.
Implementation
FContextMenu({
this.control = const .managed(),
this.style = const .context(),
this.scrollController,
this.scrollCacheExtent,
this.maxHeight = .infinity,
this.intrinsicWidth = true,
this.dragStartBehavior = .start,
this.divider = .full,
this.menuAnchor = .topLeft,
this.spacing = 0,
this.overflow = .flip,
this.useViewPadding = true,
this.useViewInsets = true,
this.offset = .zero,
this.groupId,
this.hideRegion = .excludeChild,
this.onTapHide,
this.barrierSemanticsLabel,
this.barrierSemanticsDismissible = true,
this.cutout = false,
this.cutoutBuilder = FModalBarrier.defaultCutoutBuilder,
this.semanticsLabel,
this.autofocus,
this.focusNode,
this.onFocusChange,
this.traversalEdgeBehavior,
this.faded,
this.longPress,
this.secondaryPress,
this.builder = FPopover.defaultBuilder,
this.child,
List<FItemGroupMixin> Function(BuildContext context, FPopoverController controller, List<FItemGroupMixin>? menu)
menuBuilder =
FPopoverMenu.defaultItemBuilder,
List<FItemGroupMixin>? menu,
super.key,
}) : assert(builder != FPopover.defaultBuilder || child != null, 'Either builder or child must be provided'),
_menuBuilder = ((context, controller, style) => FItemGroup.merge(
scrollController: scrollController,
scrollCacheExtent: scrollCacheExtent,
maxHeight: maxHeight,
intrinsicWidth: intrinsicWidth,
dragStartBehavior: dragStartBehavior,
semanticsLabel: semanticsLabel,
style: style.itemGroupStyle,
divider: divider,
children: menuBuilder(context, controller, menu),
)),
assert(
menuBuilder != FPopoverMenu.defaultItemBuilder || menu != null,
'Either menuBuilder or menu must be provided',
);