From 01a7d7aed8c102cc8b7052d5d225d02c299b609a Mon Sep 17 00:00:00 2001 From: xfy Date: Mon, 25 May 2026 16:47:04 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20CalendarPager=20alpha()=20=E2=86=92=20g?= =?UTF-8?q?raphicsLayer=20=E9=81=BF=E5=85=8D=E6=BB=91=E5=8A=A8=E9=87=8D?= =?UTF-8?q?=E7=BB=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 月份切换滑动时 pageOffset 每帧变化,alpha() Modifier 触发重组。 改用 graphicsLayer 在 draw 阶段更新透明度,跳过 Composition/Layout。 Co-Authored-By: Claude Opus 4.7 (1M context) --- core/src/main/kotlin/plus/rua/project/ui/CalendarPager.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/main/kotlin/plus/rua/project/ui/CalendarPager.kt b/core/src/main/kotlin/plus/rua/project/ui/CalendarPager.kt index 73b8a1b..6388821 100644 --- a/core/src/main/kotlin/plus/rua/project/ui/CalendarPager.kt +++ b/core/src/main/kotlin/plus/rua/project/ui/CalendarPager.kt @@ -11,7 +11,7 @@ import androidx.compose.runtime.remember import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.runtime.snapshotFlow import androidx.compose.ui.Modifier -import androidx.compose.ui.draw.alpha +import androidx.compose.ui.graphics.graphicsLayer import kotlinx.coroutines.flow.drop import kotlinx.coroutines.launch import kotlinx.datetime.LocalDate @@ -117,7 +117,7 @@ fun CalendarPager( shiftKindAt = shiftKindAt, showLegalHoliday = showLegalHoliday, onRowHeightMeasured = onRowHeightMeasured, - modifier = Modifier.alpha(alpha) + modifier = Modifier.graphicsLayer { this.alpha = alpha } ) } } \ No newline at end of file