FPopoverMenu constructor
FPopoverMenu({
- FPopoverController? popoverController,
- ScrollController? scrollController,
- FPopoverMenuStyle style(
- FPopoverMenuStyle style
- double? cacheExtent,
- double maxHeight = double.infinity,
- DragStartBehavior dragStartBehavior = DragStartBehavior.start,
- FItemDivider divider = FItemDivider.full,
- AlignmentGeometry childAnchor = Alignment.bottomCenter,
- FPortalSpacing spacing = const FPortalSpacing(4),
- Offset shift(
- Size size,
- FPortalChildBox childBox,
- FPortalBox portalBox
- Offset offset = Offset.zero,
- Object? groupId,
- FPopoverHideRegion hideRegion = FPopoverHideRegion.excludeChild,
- VoidCallback? onTapHide,
- String? barrierSemanticsLabel,
- bool barrierSemanticsDismissible = true,
- String? semanticsLabel,
- bool? autofocus,
- FocusScopeNode? focusNode,
- ValueChanged<
bool> ? onFocusChange, - TraversalEdgeBehavior? traversalEdgeBehavior,
- ValueWidgetBuilder<
FPopoverController> builder = _builder, - Widget? child,
- 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
norchild
is provided. - neither
menuBuilder
normenu
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');