FPopover.automatic constructor

FPopover.automatic({
  1. required ValueWidgetBuilder<FPopoverStyle> popoverBuilder,
  2. required Widget child,
  3. FPopoverController? controller,
  4. FPopoverStyle? style,
  5. FPortalConstraints constraints = const FPortalConstraints(),
  6. FPortalSpacing spacing = const FPortalSpacing(4),
  7. Offset shift(
    1. Size,
    2. FPortalChildBox,
    3. FPortalBox
    ) = FPortalShift.flip,
  8. Offset offset = Offset.zero,
  9. Object? groupId,
  10. FHidePopoverRegion hideOnTapOutside = FHidePopoverRegion.excludeTarget,
  11. bool autofocus = false,
  12. FocusScopeNode? focusNode,
  13. ValueChanged<bool>? onFocusChange,
  14. TraversalEdgeBehavior traversalEdgeBehavior = TraversalEdgeBehavior.closedLoop,
  15. String? semanticsLabel,
  16. Map<ShortcutActivator, VoidCallback>? shortcuts,
  17. AlignmentGeometry? popoverAnchor,
  18. AlignmentGeometry? childAnchor,
  19. Key? key,
})

Creates a popover that is automatically shown when the child is tapped.

It is not recommended for the child to contain a GestureDetector, such as FButton. Only one GestureDetector will be called if there are multiple overlapping GestureDetectors, leading to unexpected behavior.

Implementation

FPopover.automatic({
  required this.popoverBuilder,
  required this.child,
  this.controller,
  this.style,
  this.constraints = const FPortalConstraints(),
  this.spacing = const FPortalSpacing(4),
  this.shift = FPortalShift.flip,
  this.offset = Offset.zero,
  this.groupId,
  this.hideOnTapOutside = FHidePopoverRegion.excludeTarget,
  this.autofocus = false,
  this.focusNode,
  this.onFocusChange,
  this.traversalEdgeBehavior = TraversalEdgeBehavior.closedLoop,
  this.semanticsLabel,
  this.shortcuts,
  AlignmentGeometry? popoverAnchor,
  AlignmentGeometry? childAnchor,
  super.key,
}) : assert(
       groupId == null || hideOnTapOutside == FHidePopoverRegion.excludeTarget,
       'groupId can only be used with FHidePopoverRegion.excludeTarget',
     ),
     popoverAnchor = popoverAnchor ?? defaultPlatform.popover,
     childAnchor = childAnchor ?? defaultPlatform.child,
     _automatic = true;