Interface

LookaheadScope

[LookaheadScope] provides a receiver scope for all (direct and indirect) child layouts in [LookaheadScope].

Common
interface LookaheadScope

LookaheadScope provides a receiver scope for all (direct and indirect) child layouts in LookaheadScope. This receiver scope allows access to lookaheadScopeCoordinates from any child's Placeable.PlacementScope. It also allows any child to convert LayoutCoordinates (which can be retrieved in Placeable.PlacementScope) to LayoutCoordinates in lookahead coordinate space using toLookaheadCoordinates.

Properties

Common
val Placeable.PlacementScope.lookaheadScopeCoordinates: LayoutCoordinates

Returns the LayoutCoordinates of the LookaheadScope. This is only accessible from Placeable.PlacementScope (i.e. during placement time).

Note: The returned coordinates is not coordinates in the lookahead coordinate space. If the lookahead coordinates of the lookaheadScope is needed, suggest converting the returned coordinates using toLookaheadCoordinates.

Functions

toLookaheadCoordinates

fun LayoutCoordinates.toLookaheadCoordinates(): LayoutCoordinates

Converts a LayoutCoordinates into a LayoutCoordinates in the Lookahead coordinate space. This can be used for layouts within LookaheadScope.


localLookaheadPositionOf

fun LayoutCoordinates.localLookaheadPositionOf(
        sourceCoordinates: LayoutCoordinates,
        relativeToSource: Offset = Offset.Zero,
        includeMotionFrameOfReference: Boolean = true,
    ): Offset

Converts relativeToSource in sourceCoordinates's lookahead coordinate space into local lookahead coordinates. This is a convenient method for 1) converting both this coordinates and sourceCoordinates into lookahead space coordinates using toLookaheadCoordinates, and 2) invoking LayoutCoordinates.localPositionOf with the converted coordinates.

For layouts where LayoutCoordinates.introducesMotionFrameOfReference returns true (placed under Placeable.PlacementScope.withMotionFrameOfReferencePlacement) you may pass includeMotionFrameOfReference as false to get their position while excluding the additional Offset.