🌈 Create new beautiful Compose Gradients with our new wesite ->
Interface

TransformingLazyColumnFirstLayoutItemProvider

Provides the first item to layout for TransformingLazyColumn.

Source set: Android
public interface TransformingLazyColumnFirstLayoutItemProvider

Provides the first item to layout for TransformingLazyColumn.

During a measurement pass, TransformingLazyColumn uses the item returned by this provider as the initial placement reference. TransformingLazyColumn measures this item and places its requested ItemInfo.itemEdge visual edge at the exact screen coordinate defined by ItemInfo.offset, prior to accounting for active scroll deltas. Once this initial item is positioned, all other visible items are sequentially composed and placed above and below it.

Providing this interface allows controlling how the list places its children during content updates like additions, removals, or item size changes.

Functions

getFirstLayoutItem

Source set: Android
public fun getFirstLayoutItem(centerItem: ItemInfo): ItemInfo

Returns the ItemInfo for the first item to layout in TransformingLazyColumn.

Note: This method is executed internally inside a Snapshot.withoutReadObservation block. Any Compose state reads performed inside this callback will not trigger layout observation.

If the returned ItemInfo cannot be fully resolved (e.g., the key is not found or the index is out of bounds), TransformingLazyColumn falls back:

  • If the ItemInfo.key is not found, it falls back to the ItemInfo.index.
  • The final resolved index is coerced to stay within the valid list bounds.

Parameters

centerItem The ItemInfo that TransformingLazyColumn would currently use for the first layout item if no provider is supplied. Returning this item preserves the default layout behavior. In most cases, this is the item closest to the center of the viewport from TransformingLazyColumnLayoutInfo.visibleItems.

Return

The ItemInfo of the item to use as the first item to layout.

Members

ItemEdge

Source set: Android
public class ItemEdge internal constructor(internal val type: Int)

Represents the visual edge of ItemInfo (Start or End) to which the offset refers.

Functions

toString

Source set: Android
override fun toString(): String

Members

Companion

Source set: Android
public companion object

Properties

Start

Source set: Android
public val Start: ItemEdge = ItemEdge(0)

The start edge of the item.

For normal layout this will be the visual top edge of the item. For reverseLayout it will be the visual bottom edge.

When requested, TransformingLazyColumn starts laying out items from this edge. For example, during item size animations (such as expansion), the item expands towards the logical end of the list relative to this start edge.

End

Source set: Android
public val End: ItemEdge = ItemEdge(1)

The end edge of the item.

For normal layout this will be the visual bottom edge of the item. For reverseLayout it will be the visual top edge.

When requested, TransformingLazyColumn starts laying out items from this edge. For example, during item size animations (such as expansion), the item expands towards the logical start of the list relative to this end edge.

ItemInfo

Source set: Android
public class ItemInfo(
        public val index: Int,
        public val itemEdge: ItemEdge,
        public val offset: Int,
        public val key: Any? = null,
    )

Holds information about the first item to layout in TransformingLazyColumn.

During measurement, TransformingLazyColumn resolves this item to its index, measures it, and arranges all other items relative to its offset screen coordinate.

Functions

equals

Source set: Android
override fun equals(other: Any?): Boolean

hashCode

Source set: Android
override fun hashCode(): Int

toString

Source set: Android
override fun toString(): String

Content updated: