From 79f76d56d04b261561784e4b4ff48e121dc6c1ed Mon Sep 17 00:00:00 2001 From: MadFlasheroo7 Date: Fri, 23 Aug 2024 14:13:27 +0530 Subject: [PATCH] =?UTF-8?q?changes:=20update=20animation=20card=20to=20ani?= =?UTF-8?q?mate=20=F0=9F=99=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../animations/ui/screens/AnimationCard.kt | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/pro/jayeshseth/animations/ui/screens/AnimationCard.kt b/app/src/main/java/pro/jayeshseth/animations/ui/screens/AnimationCard.kt index 105d4ae..b0a06b3 100644 --- a/app/src/main/java/pro/jayeshseth/animations/ui/screens/AnimationCard.kt +++ b/app/src/main/java/pro/jayeshseth/animations/ui/screens/AnimationCard.kt @@ -1,5 +1,8 @@ package pro.jayeshseth.animations.ui.screens +import androidx.compose.animation.animateContentSize +import androidx.compose.animation.core.tween +import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.fillMaxWidth @@ -26,7 +29,8 @@ fun AnimationCard(animationScreen: AnimationScreen) { Column( modifier = Modifier .fillMaxWidth() - .padding(12.dp), + .padding(12.dp) + .animateContentSize(tween(500)), horizontalAlignment = Alignment.CenterHorizontally ) { Text( @@ -37,7 +41,11 @@ fun AnimationCard(animationScreen: AnimationScreen) { fontSize = 20.sp, fontWeight = FontWeight.SemiBold ) - animationScreen.content(isVisible) + Box( + Modifier.animateContentSize(tween(500)) + ) { + animationScreen.content(isVisible) + } InteractiveButton( text = "Animate", onClick = { isVisible = !isVisible },