perf: CalendarPager alpha() → graphicsLayer 避免滑动重组
月份切换滑动时 pageOffset 每帧变化,alpha() Modifier 触发重组。 改用 graphicsLayer 在 draw 阶段更新透明度,跳过 Composition/Layout。 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
da46204de4
commit
01a7d7aed8
@ -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 }
|
||||
)
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user