FContextMenu constructor

FContextMenu({
  1. FPopoverControl control = const .managed(),
  2. FPopoverMenuStyleDelta style = const .context(),
  3. ScrollController? scrollController,
  4. ScrollCacheExtent? scrollCacheExtent,
  5. double maxHeight = .infinity,
  6. bool intrinsicWidth = true,
  7. DragStartBehavior dragStartBehavior = .start,
  8. FItemDivider divider = .full,
  9. AlignmentGeometry menuAnchor = .topLeft,
  10. double spacing = 0,
  11. FPortalOverflow overflow = .flip,
  12. bool useViewPadding = true,
  13. bool useViewInsets = true,
  14. Offset offset = .zero,
  15. Object? groupId,
  16. FPopoverHideRegion hideRegion = .excludeChild,
  17. VoidCallback? onTapHide,
  18. String? barrierSemanticsLabel,
  19. bool barrierSemanticsDismissible = true,
  20. bool cutout = false,
  21. void cutoutBuilder(
    1. Path path,
    2. Rect bounds
    ) = FModalBarrier.defaultCutoutBuilder,
  22. String? semanticsLabel,
  23. bool? autofocus,
  24. FocusScopeNode? focusNode,
  25. ValueChanged<bool>? onFocusChange,
  26. TraversalEdgeBehavior? traversalEdgeBehavior,
  27. bool? faded,
  28. bool? longPress,
  29. bool? secondaryPress,
  30. ValueWidgetBuilder<FPopoverController> builder = FPopover.defaultBuilder,
  31. Widget? child,
  32. List<FItemGroupMixin> menuBuilder(
    1. BuildContext context,
    2. FPopoverController controller,
    3. List<FItemGroupMixin>? menu
    ) = FPopoverMenu.defaultItemBuilder,
  33. List<FItemGroupMixin>? menu,
  34. 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',
     );