Zoltan Demant
12/30/2023, 1:51 PMContentTransform
and/or SizeTransform
should only animate size changes for height when used with AnimatedContent
?Zoltan Demant
12/30/2023, 1:54 PMDoris Liu
01/02/2024, 7:35 PM// enum class CartState { Expanded, Collapsed }
val transitionSpec: AnimatedContentTransitionScope<CartState>.() -> ContentTransform =
{
// Fade in with a delay so that it starts after fade out
fadeIn(animationSpec = tween(150, delayMillis = 150))
.togetherWith(fadeOut(animationSpec = tween(150)))
.using(
SizeTransform { initialSize, targetSize ->
keyframes {
durationMillis = 500
// Set to full target width immediately
IntSize(targetSize.width, initialSize.height) at 0
}
}
)
}
2. Use fillMaxWidth
on loading indicator, so that the width doesn't change when the content comes in. This would only work if the content fills the max width allotted by parent.
or 3. Allow the size animation, but not move the horizontal position of the content. To achieve that you could add wrapContentWidth(Alignment.Start, unbounded = true)
to your content so that it doesn't center itself in the changing sized container, but rather gets anchored to the starting edge (i.e. left edge in LTR) of the parent.Zoltan Demant
01/03/2024, 1:06 PMZoltan Demant
01/06/2024, 12:31 PMSizeTransform(clip=false)
, which caught me completely off guard. Maybe Im just misunderstanding what clip does, or do you agree that this is odd? The only logical explanation I can think of is that the loader never has a chance to show up before content is loaded; but Im still not sure how/why clip=false would solve that 😅Doris Liu
01/08/2024, 6:15 PMclip = false
?Zoltan Demant
01/10/2024, 3:06 PM