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
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.keyis not found, it falls back to theItemInfo.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
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
override fun toString(): String
Members
Companion
public companion object
Properties
Start
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
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
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
override fun equals(other: Any?): Boolean
hashCode
override fun hashCode(): Int
toString
override fun toString(): String