feat: add animated tab visibility with alpha transitions in AppScreen

This commit is contained in:
tapframe 2026-03-11 23:00:12 +05:30
parent 5144a2b036
commit 5c998be2c2

View file

@ -5,6 +5,8 @@ import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.animation.core.animateFloatAsState
import androidx.compose.animation.core.tween
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.rounded.Home
import androidx.compose.material.icons.rounded.Search
@ -191,11 +193,16 @@ fun App() {
.padding(innerPadding),
) {
AppScreenTab.entries.forEach { tab ->
val tabAlpha by animateFloatAsState(
targetValue = if (selectedTab == tab) 1f else 0f,
animationSpec = tween(durationMillis = 220),
label = "tab_alpha_${tab.name}",
)
AppScreen(
tab = tab,
modifier = Modifier
.fillMaxSize()
.alpha(if (selectedTab == tab) 1f else 0f)
.alpha(tabAlpha)
.zIndex(if (selectedTab == tab) 1f else 0f),
onCatalogClick = onCatalogClick,
onPosterClick = { meta ->