TooltipPlacementDelegate class
Tooltip placement relative to its target.
Currently: side chosen from a snapshot rect on step change + keep-in-screen; recomputing placement on scroll and multi-content collisions are follow-up work.
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 — mirror (bottom↔top, left↔right); still not fitting — the other sides; last resort (tooltip or hole larger than the screen) — a screen corner with a margin.
- Inheritance
-
- Object
- SingleChildLayoutDelegate
- TooltipPlacementDelegate
Constructors
- TooltipPlacementDelegate({required Rect screenLocal, required Rect holeLocal, required TooltipPosition position, double gap = 12})
Properties
- 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
- 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