Skip to content

Commit 79f76d5

Browse files
committed
changes: update animation card to animate 🙂
1 parent 864f879 commit 79f76d5

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

app/src/main/java/pro/jayeshseth/animations/ui/screens/AnimationCard.kt

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
package pro.jayeshseth.animations.ui.screens
22

3+
import androidx.compose.animation.animateContentSize
4+
import androidx.compose.animation.core.tween
5+
import androidx.compose.foundation.layout.Box
36
import androidx.compose.foundation.layout.Column
47
import androidx.compose.foundation.layout.PaddingValues
58
import androidx.compose.foundation.layout.fillMaxWidth
@@ -26,7 +29,8 @@ fun AnimationCard(animationScreen: AnimationScreen) {
2629
Column(
2730
modifier = Modifier
2831
.fillMaxWidth()
29-
.padding(12.dp),
32+
.padding(12.dp)
33+
.animateContentSize(tween(500)),
3034
horizontalAlignment = Alignment.CenterHorizontally
3135
) {
3236
Text(
@@ -37,7 +41,11 @@ fun AnimationCard(animationScreen: AnimationScreen) {
3741
fontSize = 20.sp,
3842
fontWeight = FontWeight.SemiBold
3943
)
40-
animationScreen.content(isVisible)
44+
Box(
45+
Modifier.animateContentSize(tween(500))
46+
) {
47+
animationScreen.content(isVisible)
48+
}
4149
InteractiveButton(
4250
text = "Animate",
4351
onClick = { isVisible = !isVisible },

0 commit comments

Comments
 (0)