SubcomposeLayoutState
-
Cmn
class SubcomposeLayoutState
State used by SubcomposeLayout.
slotReusePolicy the policy defining what slots should be retained to be reused later.
Summary
Nested types |
|---|
sealed interface SubcomposeLayoutState.PausedPrecompositionA |
|
Instance of this interface is returned by |
Public constructors |
|
|---|---|
|
State used by |
Cmn
|
This function is deprecated. This constructor is deprecated |
Cmn
|
SubcomposeLayoutState(slotReusePolicy: SubcomposeSlotReusePolicy) |
Cmn
|
Public functions |
||
|---|---|---|
SubcomposeLayoutState.PausedPrecomposition |
createPausedPrecomposition(slotId: Any?, content: @Composable () -> Unit)Creates |
Cmn
|
SubcomposeLayoutState.PrecomposedSlotHandle |
precompose(slotId: Any?, content: @Composable () -> Unit)Composes the content for the given |
Cmn
|
Public constructors
SubcomposeLayoutState
SubcomposeLayoutState(maxSlotsToRetainForReuse: Int)
State used by SubcomposeLayout.
| Parameters | |
|---|---|
maxSlotsToRetainForReuse: Int |
when non-zero the layout will keep active up to this count slots which we were used but not used anymore instead of disposing them. Later when you try to compose a new slot instead of creating a completely new slot the layout would reuse the previous slot which allows to do less work especially if the slot contents are similar. |
Public functions
createPausedPrecomposition
fun createPausedPrecomposition(slotId: Any?, content: @Composable () -> Unit): SubcomposeLayoutState.PausedPrecomposition
Creates PausedPrecomposition, which allows to perform the composition in an incremental manner.
| Parameters | |
|---|---|
slotId: Any? |
unique id which represents the slot to compose into. |
content: @Composable () -> Unit |
the composable content which defines the slot.] |
| Returns | |
|---|---|
SubcomposeLayoutState.PausedPrecomposition |
|
precompose
fun precompose(slotId: Any?, content: @Composable () -> Unit): SubcomposeLayoutState.PrecomposedSlotHandle
Composes the content for the given slotId. This makes the next scope.subcompose(slotId) call during the measure pass faster as the content is already composed.
If the slotId was precomposed already but after the future calculations ended up to not be needed anymore (meaning this slotId is not going to be used during the measure pass anytime soon) you can use PrecomposedSlotHandle.dispose on a returned object to dispose the content.
| Parameters | |
|---|---|
slotId: Any? |
unique id which represents the slot to compose into. |
content: @Composable () -> Unit |
the composable content which defines the slot. |
| Returns | |
|---|---|
SubcomposeLayoutState.PrecomposedSlotHandle |
|