public interface BeyondBoundsLayout
Layout extra items in the specified direction.
A BeyondBoundsLayout instance can be obtained by searching the tree using DelegatableNode.findNearestBeyondBoundsLayoutAncestor(). It can be used to send a request to layout more items in a particular direction. This can be useful when composition or layout is determined lazily, as with a LazyColumn. The request is received by any parent up the hierarchy that provides this modifier local.
Functions
layout
public fun <T> layout(direction: LayoutDirection, block: BeyondBoundsScope.() -> T?): T?
Send a request to layout more items in the specified direction. The request is received by a parent up the hierarchy. The parent adds one item at a time and calls block after each item is added. The parent continues adding new items as long as block returns null. Once you have all the items you need, you can perform some operation and return a non-null value. Returning this value stops the laying out of beyond bounds items. (Note that you have to return a non-null value stop iterating).
Parameters
| direction | The direction from the visible bounds in which more items are requested. |
| block | Continue to layout more items until this block returns a non null item. |
Return
The value returned by the last run of block. If we layout all the available items then the returned value is null. When this function returns all the beyond bounds items may be disposed. Therefore you have to perform any custom logic within the block and return the value you need.
Members
BeyondBoundsScope
public interface BeyondBoundsScope
The scope used in BeyondBoundsLayout.layout.
Properties
hasMoreContent
public val hasMoreContent: Boolean
Whether we have more content to lay out in the specified direction.
LayoutDirection
public class LayoutDirection internal constructor(@Suppress("unused") private val value: Int)
The direction (from the visible bounds) that a BeyondBoundsLayout is requesting more items to be laid.
Members
Companion
public companion object
Properties
Before
public val Before: LayoutDirection
Direction used in BeyondBoundsLayout.layout to request the layout of extra items before the current bounds.
After
public val After: LayoutDirection
Direction used in BeyondBoundsLayout.layout to request the layout of extra items after the current bounds.
Left
public val Left: LayoutDirection
Direction used in BeyondBoundsLayout.layout to request the layout of extra items to the left of the current bounds.
Right
public val Right: LayoutDirection
Direction used in BeyondBoundsLayout.layout to request the layout of extra items to the right of the current bounds.
Above
public val Above: LayoutDirection
Direction used in BeyondBoundsLayout.layout to request the layout of extra items above the current bounds.
Below
public val Below: LayoutDirection
Direction used in BeyondBoundsLayout.layout to request the layout of extra items below the current bounds.