From 23909e855f30f7506e942feb7dffec287280855f Mon Sep 17 00:00:00 2001 From: xfy Date: Mon, 1 Jun 2026 14:00:18 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E7=AE=80=E5=8C=96=20BottomCard=20?= =?UTF-8?q?=E5=B9=B4=E8=A7=86=E5=9B=BE=E5=88=87=E6=8D=A2=E5=8A=A8=E7=94=BB?= =?UTF-8?q?=E5=B9=B6=E7=A7=BB=E9=99=A4=E8=B0=83=E8=AF=95=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 将 slideAnim 初始值固定为 1f(屏幕外),简化年↔月切换逻辑 - 移除 BottomCard 区域的调试 logd 日志 - fadeIn easing 从 FastOutSlowInEasing 改为 LinearOutSlowInEasing Co-Authored-By: Claude Opus 4.7 (1M context) --- .../plus/rua/project/ui/CalendarMonthView.kt | 24 ++++--------------- 1 file changed, 5 insertions(+), 19 deletions(-) diff --git a/core/src/main/kotlin/plus/rua/project/ui/CalendarMonthView.kt b/core/src/main/kotlin/plus/rua/project/ui/CalendarMonthView.kt index c57536a..b74aab9 100644 --- a/core/src/main/kotlin/plus/rua/project/ui/CalendarMonthView.kt +++ b/core/src/main/kotlin/plus/rua/project/ui/CalendarMonthView.kt @@ -5,6 +5,7 @@ import androidx.compose.animation.AnimatedVisibility import androidx.compose.animation.EnterTransition import androidx.compose.animation.ExitTransition import androidx.compose.animation.core.FastOutSlowInEasing +import androidx.compose.animation.core.LinearOutSlowInEasing import androidx.compose.animation.core.Spring import androidx.compose.animation.core.Animatable import androidx.compose.animation.core.animateFloatAsState @@ -195,7 +196,7 @@ fun CalendarMonthView( val enter = scaleIn( initialScale = 0.85f, animationSpec = tween(350, easing = FastOutSlowInEasing) - ) + fadeIn(tween(350, easing = FastOutSlowInEasing)) + ) + fadeIn(tween(350, easing = LinearOutSlowInEasing)) val exit = scaleOut( targetScale = 0.85f, animationSpec = tween(350, easing = FastOutSlowInEasing) @@ -583,38 +584,23 @@ private fun BottomCardArea( dragRangeMinPx } - val slideAnim = remember { Animatable(if (isYearView) 1f else 0f) } + // 初始值固定为 1f(屏幕外),确保年→月切换时 BottomCard 能从屏幕外滑入 + val slideAnim = remember { Animatable(1f) } LaunchedEffect(isYearView) { - if (isYearView) { - slideAnim.animateTo(1f, tween(200)) - } else { - slideAnim.snapTo(1f) - delay(200) - slideAnim.animateTo(0f, tween(150)) - } + slideAnim.animateTo(if (isYearView) 1f else 0f, tween(200)) } val slideProgress = slideAnim.value - var lastLoggedSlide by remember { mutableStateOf(-1f) } - SideEffect { - if (kotlin.math.abs(lastLoggedSlide - slideProgress) > 0.001f) { - lastLoggedSlide = slideProgress - logd("AnimLog", "[BottomCard] slideProgress=$slideProgress isYearView=$isYearView") - } - } // 延迟一帧显示 BottomCard,避免 AnimatedGif 和 lunar 计算阻塞首帧 var hasLoaded by remember { mutableStateOf(false) } LaunchedEffect(Unit) { delay(32) hasLoaded = true - logd("AnimLog", "[BottomCard] hasLoaded=true after delay") } val shouldShow = hasLoaded val uiState by viewModel.uiState.collectAsState() val shiftKind = viewModel.shiftKindAt(uiState.selectedDate) - logd("AnimLog", "[BottomCard] shouldShow=$shouldShow isYearView=$isYearView slideProgress=$slideProgress dragRangePx=$dragRangePx rowHeightPx=$rowHeightPx") - if (shouldShow) { BottomCard( isCollapsed = uiState.isCollapsed,