TooltipPlacementDelegate class

Tooltip placement relative to its target.

Side chosen from the live target rect: the overlay recreates this delegate with the current holeLocal on every movement frame (see overlay_engine.dart), so placement — auto-flip and safe-area included — is recomputed on scroll, not just on step change.

Keep-in-safe-area: the tooltip stays inside screenLocal.deflate(safeArea) (system insets — notch, home indicator). The safe rect is also the space auto-placement counts free space against, so a target under the notch does not pick a side that only "fits" in the inset zone.

Why CustomSingleChildLayout: the tooltip size is unknown before layout (text), and the delegate receives it from the framework in getPositionForChild (childSize) — no manual text measuring ("no dry-layout"). The box itself is sized to the screen (default getSize = constraints.biggest), so the tooltip buttons are hit-testable anywhere on screen, and taps past the tooltip fall through (hitTestSelf = false) onto the scrim.

Side selection: try the preferred side; if it does not fit the safe rect — mirror (bottom↔top, left↔right); still not fitting — the other sides; last resort (tooltip or hole larger than the screen) — a safe-rect corner with a margin.

Inheritance

Constructors

TooltipPlacementDelegate({required Rect screenLocal, required Rect holeLocal, required TooltipPosition position, double gap = _kGap, EdgeInsets safeArea = EdgeInsets.zero, List<Rect> extraHoles = const []})

Properties

extraHoles List<Rect>
Additional spotlighted targets of the step (multi-target steps): the tooltip must not cover them, only the primary holeLocal may be overlapped (it is the tooltip's anchor). Side selection still counts free space against the primary hole; extras only veto a placement that would sit on top of another spotlighted element.
final
gap double
Gap between the tooltip and the hole.
final
hashCode int
The hash code for this object.
no setterinherited
holeLocal Rect
The target (scrim hole) rect in the same coordinates: translation & leaderSize.
final
position TooltipPosition
Preferred side; TooltipPosition.auto — the side with the most free space between the hole and the screen edge.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
safeArea EdgeInsets
System insets (MediaQuery.padding — notch, home indicator): the tooltip stays inside screenLocal.deflate(safeArea). Zero — the whole screen is usable (the previous behavior).
final
screenLocal Rect
The screen in the tooltip layer's coordinates (global here — the tooltip lives in the full-screen overlay layer, see overlay_engine.dart).
final

Methods

getConstraintsForChild(BoxConstraints constraints) BoxConstraints
The tooltip gets loose constraints (up to screen size) and picks its own size; a tight box would stretch it over the whole screen.
override
getPositionForChild(Size size, Size childSize) Offset
size — the layout box size (= the screen, see class doc); childSize — the tooltip's actual size after layout.
override
getSize(BoxConstraints constraints) Size
The size of this object given the incoming constraints.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
shouldRelayout(covariant TooltipPlacementDelegate oldDelegate) bool
Called whenever a new instance of the custom layout delegate class is provided to the RenderCustomSingleChildLayoutBox object, or any time that a new CustomSingleChildLayout object is created with a new instance of the custom layout delegate class (which amounts to the same thing, because the latter is implemented in terms of the former).
override
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited