DesignAnchoredOverlay class

A surface anchored to anchorBuilder's widget: a popover (DesignOverlayTrigger.press, focusOnOpen), a hover card (DesignOverlayTrigger.hover) or a menu (arrowKeyNavigation on).

On open, focus moves into the surface (when focusOnOpen) and Tab stays inside it; Escape, a tap outside or Android's back closes it, and focus goes back to where it was (the anchor). The surface takes the side with room (DesignOverlayPlacement) and DesignOverlayInfo.side says which; it keeps clear of the screen's safe area, the on-screen keyboard and a DesignOverlayPadding above it. DesignOverlayInfo.surfaceRect says where it landed, for a tail or an arrow.

controller.open(position: offset) (an offset in the anchor) opens it at that point, as a context menu opens at the pointer: below the point and from its start in reading order, above it or towards its other end where there is no room. DesignOverlayInfo.position says so.

DesignAnchoredOverlay(anchorBuilder: (context, anchor) => GestureDetector(onTap: anchor.toggle, child: const Text('More')), overlayBuilder: (context, info) => const Text('Details'))
Inheritance

Constructors

DesignAnchoredOverlay({Key? key, required DesignOverlayAnchorBuilder anchorBuilder, required DesignOverlaySurfaceBuilder overlayBuilder, MenuController? controller, DesignOverlayTrigger trigger = DesignOverlayTrigger.press, DesignOverlayPlacement placement = const DesignOverlayPlacement(), bool focusOnOpen = true, bool arrowKeyNavigation = false, String? semanticLabel, ValueChanged<bool>? onOpenChanged, Duration hoverOpenDelay = const Duration(milliseconds: 700), Duration hoverCloseDelay = const Duration(milliseconds: 300), bool consumeOutsideTaps = false, bool useRootOverlay = false, double dampingRatio = 1, double stiffness = 1400})
A surface anchored to anchorBuilder's widget.
const

Properties

anchorBuilder → DesignOverlayAnchorBuilder
Paints the anchor; a press trigger calls DesignOverlayAnchor.toggle.
final
arrowKeyNavigation → bool
Whether Up and Down move focus through the surface's items, wrapping, and Home and End go to the first and last: a menu; false by default. The arrows on the anchor are then the anchor's own and its ancestors' (a menubar moves along on them), never a move by geometry.
final
consumeOutsideTaps → bool
Whether a tap outside that closes it goes no further.
final
controller → MenuController?
Opens and closes it from outside, and opens it at a point (open(position:)); null: it makes its own.
final
dampingRatio → double
The presence spring's damping ratio (ζ).
final
focusOnOpen → bool
Whether focus moves into the surface when it opens (a popover, a menu) and Tab stays inside it; true by default. A hover card leaves focus on its anchor.
final
hashCode → int
The hash code for this object.
no setterinherited
hoverCloseDelay → Duration
A hover card's wait before it closes once the pointer leaves.
final
hoverOpenDelay → Duration
A hover card's wait before it opens.
final
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
onOpenChanged → ValueChanged<bool>?
Called when it opens (true) or closes (false).
final
overlayBuilder → DesignOverlaySurfaceBuilder
Paints the surface.
final
placement → DesignOverlayPlacement
Where it goes.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
semanticLabel → String?
What a screen reader calls the surface.
final
stiffness → double
The presence spring's stiffness (k).
final
trigger → DesignOverlayTrigger
What opens it.
final
useRootOverlay → bool
Whether it shows in the root overlay rather than the nearest.
final

Methods

createElement() → StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() → State<DesignAnchoredOverlay>
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