SafePopupPositionProvider

Positions the popup relative to the anchor's bounds on the side(s) indicated by alignment. Vertically, Top/Bottom always place the popup fully above/below the anchor (never overlapping it) plus IntOffset.y of gap, and Center centers it on the anchor's vertical axis. Horizontally, behavior depends on whether the alignment is a true corner (TopStart/TopEnd/BottomStart/BottomEnd) or a pure side flyout (CenterStart/CenterEnd):

  • Corners flush-align the popup's matching edge with the anchor's edge (e.g. BottomEnd hangs below the anchor with its right edge lined up with the anchor's right edge, like a typical dropdown menu), and IntOffset.x is a plain translation from that flush position — positive shifts right, negative shifts left. This lets a corner popup anchored near a screen edge be nudged back on-screen with a negative offset.

  • CenterStart/CenterEnd render fully outside the anchor to the left/right (mirrored for RTL), with IntOffset.x as a positive gap from the anchor. TopCenter/Center/BottomCenter center the popup horizontally on the anchor, with IntOffset.x applied as a plain translation.

Constructors

Link copied to clipboard
constructor(alignment: AlignmentSchema.TwoDimensional, offset: IntOffset)

Functions

Link copied to clipboard
open override fun calculatePosition(anchorBounds: IntRect, windowSize: IntSize, layoutDirection: LayoutDirection, popupContentSize: IntSize): IntOffset