https://kotlinlang.org logo
#compose
Title
# compose
o

Omkar Amberkar

09/28/2023, 5:26 PM
how do i achieve a two level slidein/out from bottom? • the first one slides in upto a certain height • when the user wants to reavel more info, it slides in completely the animatedContentHeight is not what i want since it shows a weird animation with the content inside, instead it should look like a smooth reveal something more similar to bottom sheet peek and max height
Copy code
AnimatedVisibility(
        modifier = modifier,
        visible = isVisible,
        enter = slideInVertically(initialOffsetY = { fullHeight -> fullHeight }) +
            fadeIn(tween(fadeInFadeOutTweenDuration), initialAlpha),
        exit = slideOutVertically(targetOffsetY = { fullHeight -> fullHeight }) +
            fadeOut(tween(fadeInFadeOutTweenDuration)),
        content = content
    )
t

Travis Griggs

09/28/2023, 11:15 PM
I remember I had problems with these as well. IIRC, it had an implicit shrink/expand, or something like that. I looked through my code, I think the following is what I ended up doing to get things to "slide in" and "slide out":
Copy code
enter = slideInHorizontally(initialOffsetX = { w -> w }) + expandHorizontally(expandFrom = Alignment.End),
exit = slideOutHorizontally(targetOffsetX = { w -> w }) + shrinkHorizontally(shrinkTowards = Alignment.End)