From 12eded17a778257b2ed757c0db1abae86936371f Mon Sep 17 00:00:00 2001 From: tapframe <85391825+tapframe@users.noreply.github.com> Date: Sat, 28 Mar 2026 22:12:30 +0530 Subject: [PATCH] feat: Add animated alpha transition for tab content in keepAliveTab function --- composeApp/src/commonMain/kotlin/com/nuvio/app/App.kt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/composeApp/src/commonMain/kotlin/com/nuvio/app/App.kt b/composeApp/src/commonMain/kotlin/com/nuvio/app/App.kt index dbe4e3cd2..c381ceafa 100644 --- a/composeApp/src/commonMain/kotlin/com/nuvio/app/App.kt +++ b/composeApp/src/commonMain/kotlin/com/nuvio/app/App.kt @@ -1,6 +1,7 @@ package com.nuvio.app import androidx.compose.animation.AnimatedContent +import androidx.compose.animation.core.animateFloatAsState import androidx.compose.animation.core.tween import androidx.compose.animation.fadeIn import androidx.compose.animation.fadeOut @@ -586,10 +587,16 @@ private fun BoxScope.keepAliveTab( selected: Boolean, content: @Composable () -> Unit, ) { + val contentAlpha by animateFloatAsState( + targetValue = if (selected) 1f else 0f, + animationSpec = tween(durationMillis = 220), + label = "tab_content_alpha", + ) + Box( modifier = Modifier .fillMaxSize() - .alpha(if (selected) 1f else 0f) + .alpha(contentAlpha) .zIndex(if (selected) 1f else 0f), ) { content()