commonMain.com.arkivanov.decompose.extensions.compose.stack.animation.SimpleStackAnimation.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of extensions-compose-jvm Show documentation
Show all versions of extensions-compose-jvm Show documentation
Kotlin Multiplatform lifecycle-aware business logic components
package com.arkivanov.decompose.extensions.compose.stack.animation
import androidx.compose.foundation.layout.Box
import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import com.arkivanov.decompose.Child
internal class SimpleStackAnimation(
disableInputDuringAnimation: Boolean,
private val selector: (Child.Created) -> StackAnimator?,
) : AbstractStackAnimation(disableInputDuringAnimation = disableInputDuringAnimation) {
@Composable
override fun Child(
item: AnimationItem,
onFinished: () -> Unit,
content: @Composable (child: Child.Created) -> Unit,
) {
val animator = remember(item.child.configuration) { selector(item.child) ?: EmptyStackAnimator }
animator(
direction = item.direction,
isInitial = item.isInitial,
onFinished = onFinished,
) { modifier ->
Box(modifier = modifier) {
content(item.child)
}
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy