From 12c5f312e6a9f9d70260c6c0a8007085c6fded0b Mon Sep 17 00:00:00 2001 From: Sad Ellie Date: Fri, 22 Jul 2022 20:47:27 +0300 Subject: [PATCH] Fixed animation for TopBar text --- .../com/sadellie/unitto/screens/main/AnimatedTopBarText.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/sadellie/unitto/screens/main/AnimatedTopBarText.kt b/app/src/main/java/com/sadellie/unitto/screens/main/AnimatedTopBarText.kt index 2033a21b..5bbf7f5a 100644 --- a/app/src/main/java/com/sadellie/unitto/screens/main/AnimatedTopBarText.kt +++ b/app/src/main/java/com/sadellie/unitto/screens/main/AnimatedTopBarText.kt @@ -19,6 +19,7 @@ package com.sadellie.unitto.screens.main import androidx.compose.animation.AnimatedContent +import androidx.compose.animation.SizeTransform import androidx.compose.animation.fadeIn import androidx.compose.animation.fadeOut import androidx.compose.animation.slideInVertically @@ -42,7 +43,9 @@ fun AnimatedTopBarText(showAppName: Boolean) { AnimatedContent( targetState = showAppName, transitionSpec = { - fadeIn() + slideInVertically() with fadeOut() + slideOutVertically() + (slideInVertically { height -> height } + fadeIn() with + slideOutVertically { height -> -height } + fadeOut()) + .using(SizeTransform(clip = false)) } ) { Text(