FPopoverMenu constructor

FPopoverMenu({
  1. FPopoverController? popoverController,
  2. ScrollController? scrollController,
  3. FPopoverMenuStyle style(
    1. FPopoverMenuStyle style
    )?,
  4. double? cacheExtent,
  5. double maxHeight = double.infinity,
  6. DragStartBehavior dragStartBehavior = DragStartBehavior.start,
  7. FItemDivider divider = FItemDivider.full,
  8. AlignmentGeometry menuAnchor = Alignment.topCenter,
  9. AlignmentGeometry childAnchor = Alignment.bottomCenter,
  10. FPortalSpacing spacing = const FPortalSpacing(4),
  11. Offset shift(
    1. Size size,
    2. FPortalChildBox childBox,
    3. FPortalBox portalBox
    ) = FPortalShift.flip,
  12. Offset offset = Offset.zero,
  13. Object? groupId,
  14. FPopoverHideRegion hideRegion = FPopoverHideRegion.excludeChild,
  15. VoidCallback? onTapHide,
  16. String? barrierSemanticsLabel,
  17. bool barrierSemanticsDismissible = true,
  18. String? semanticsLabel,
  19. bool? autofocus,
  20. FocusScopeNode? focusNode,
  21. ValueChanged<bool>? onFocusChange,
  22. TraversalEdgeBehavior? traversalEdgeBehavior,
  23. List<FItemGroupMixin> menuBuilder(
    1. BuildContext context,
    2. FPopoverController controller,
    3. List<FItemGroupMixin>? menu
    ) = _defaultItemBuilder,
  24. List<FItemGroupMixin>? menu,
  25. ValueWidgetBuilder<FPopoverController> builder = _builder,
  26. Widget? child,
  27. Key? key,
})

Creates a menu of FItems that is only shown when toggled.

Recommended for desktops & web.

menuBuilder is an optional builder which returns the menu that the popover is aligned to. It can incorporate a value-independent widget subtree from the menu into the returned widget tree. It can be null if the entire widget subtree the menuBuilder builds doest not require the controller.

menu is an optional list of FItemMixins that will be used as the menu items. If provided, it will be passed to menuBuilder.

Contract

Throws AssertionError if:

  • neither builder nor child is provided.
  • neither menuBuilder nor menu is provided.

Implementation

FPopoverMenu({
  this.popoverController,
  this.scrollController,
  this.style,
  this.cacheExtent,
  this.maxHeight = double.infinity,
  this.dragStartBehavior = DragStartBehavior.start,
  this.divider = FItemDivider.full,
  this.menuAnchor = Alignment.topCenter,
  this.childAnchor = Alignment.bottomCenter,
  this.spacing = const FPortalSpacing(4),
  this.shift = FPortalShift.flip,
  this.offset = Offset.zero,
  this.groupId,
  this.hideRegion = FPopoverHideRegion.excludeChild,
  this.onTapHide,
  this.barrierSemanticsLabel,
  this.barrierSemanticsDismissible = true,
  this.semanticsLabel,
  this.autofocus,
  this.focusNode,
  this.onFocusChange,
  this.traversalEdgeBehavior,
  List<FItemGroupMixin> Function(BuildContext context, FPopoverController controller, List<FItemGroupMixin>? menu)
      menuBuilder =
      _defaultItemBuilder,
  List<FItemGroupMixin>? menu,
  this.builder = _builder,
  this.child,
  super.key,
}) : _menuBuilder = ((context, controller, style) => FItemGroup.merge(
       scrollController: scrollController,
       cacheExtent: cacheExtent,
       maxHeight: maxHeight,
       dragStartBehavior: dragStartBehavior,
       semanticsLabel: semanticsLabel,
       style: style.itemGroupStyle,
       divider: divider,
       children: menuBuilder(context, controller, menu),
     )),
     assert(builder != _builder || child != null, 'Either builder or child must be provided'),
     assert(menuBuilder != _defaultTileBuilder || menu != null, 'Either menuBuilder or menu must be provided');