FPopover class
A popover displays rich content in a portal that is aligned to a child.
Nested Popovers
When placing widgets that use popovers internally, e.g. FSelect inside a FPopover, the outer popover will close
when interacting with the inner widget's dropdown. This happens because the inner dropdown is rendered in a separate
overlay layer, so tapping it is considered "outside" the outer popover.
To prevent this, share the same groupId between the outer FPopover and the inner widget. Widgets with the same
groupId are treated as part of the same tap region.
See:
- https://forui.dev/docs/overlay/popover for working examples.
- FPopoverController for controlling a popover.
- FPopoverStyle for customizing a popover's appearance.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- FPopover
Constructors
-
FPopover({required Widget popoverBuilder(BuildContext context, FPopoverController controller), FPopoverControl control = const .managed(), FPopoverStyle style(FPopoverStyle style)?, FPortalConstraints constraints = const FPortalConstraints(), FPortalSpacing spacing = const .spacing(4), FPortalOverflow overflow = .flip, Offset offset = .zero, Object? groupId, FPopoverHideRegion hideRegion = .excludeChild, VoidCallback? onTapHide, bool? autofocus, FocusScopeNode? focusNode, ValueChanged<
bool> ? onFocusChange, TraversalEdgeBehavior? traversalEdgeBehavior, String? barrierSemanticsLabel, bool barrierSemanticsDismissible = true, String? semanticsLabel, Map<ShortcutActivator, VoidCallback> ? shortcuts, ValueWidgetBuilder<FPopoverController> builder = _builder, Widget? child, AlignmentGeometry? popoverAnchor, AlignmentGeometry? childAnchor, Key? key}) - Creates a popover that only shows the popover when the controller is manually toggled.
Properties
- autofocus → bool?
-
True if this widget will be selected as the initial focus when no other node in its scope is currently focused.
final
- barrierSemanticsDismissible → bool
-
Whether the barrier semantics are included in the semantics tree. Defaults to true.
final
- barrierSemanticsLabel → String?
-
The popover's barrier label used by accessibility frameworks.
final
-
builder
→ ValueWidgetBuilder<
FPopoverController> -
An optional builder which returns the child widget that the popover is aligned to.
final
- child → Widget?
-
The child which the popover is aligned to.
final
- childAnchor → AlignmentGeometry
-
The anchor point on the child used for positioning relative to the popover's anchor.
final
- constraints → FPortalConstraints
-
The popover's size constraints.
final
- control → FPopoverControl
-
Defines how the popover's shown state is controlled.
final
- focusNode → FocusScopeNode?
-
An optional focus node to use as the focus node for this widget.
final
- groupId → Object?
-
An optional group ID that groups TapRegions together so that they operate as one region. If a tap occurs outside
of all group members, then group members that are shown will be hidden.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- hideRegion → FPopoverHideRegion
-
The region that can be tapped to hide the popover.
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- offset → Offset
-
Additional translation to apply to the popover's position.
final
-
onFocusChange
→ ValueChanged<
bool> ? -
Handler called when the focus changes.
final
- onTapHide → VoidCallback?
-
A callback that is called when the popover is hidden by tapping outside of it.
final
- overflow → FPortalOverflow
-
The callback used to shift a popover when it overflows out of the viewport.
final
- popoverAnchor → AlignmentGeometry
-
The anchor point on the popover used for positioning relative to the childAnchor.
final
- popoverBuilder → Widget Function(BuildContext context, FPopoverController controller)
-
The popover builder.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- semanticsLabel → String?
-
The popover's semantic label used by accessibility frameworks.
final
-
shortcuts
→ Map<
ShortcutActivator, VoidCallback> ? -
The shortcuts and the associated actions.
final
- spacing → FPortalSpacing
-
The spacing between the popover and child anchors.
final
- style → FPopoverStyle Function(FPopoverStyle style)?
-
The popover's style.
final
- traversalEdgeBehavior → TraversalEdgeBehavior?
-
Controls the transfer of focus beyond the first and the last items in a popover. Defaults to
TraversalEdgeBehavior.closedLoop.
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< FPopover> -
Creates the mutable state for this widget at a given location in the tree.
override
-
debugDescribeChildren(
) → List< DiagnosticsNode> -
Returns a list of DiagnosticsNode objects describing this node's
children.
inherited
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringDeep(
{String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → String -
Returns a string representation of this node and its descendants.
inherited
-
toStringShallow(
{String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a one-line detailed description of the object.
inherited
-
toStringShort(
) → String -
A short, textual description of this widget.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- defaultPlatform → ({Alignment child, Alignment popover})
-
The platform-specific default popover and child anchors.
no setter