From 266c3eede1f85a7410318109ae666887f9e553f9 Mon Sep 17 00:00:00 2001 From: xfy Date: Fri, 15 May 2026 00:20:23 +0800 Subject: [PATCH] Pass locked rowHeightPx through CalendarPager to CalendarMonthPage Add rowHeightPx parameter to CalendarPager and pass it through to CalendarMonthPage. Remove onRowHeightMeasured callback which is no longer needed since CalendarMonthPage now receives row height externally. Update CalendarMonthView to pass rowHeightPx to CalendarPager. Co-Authored-By: Claude Opus 4.7 --- .../kotlin/plus/rua/project/ui/CalendarMonthView.kt | 1 + .../commonMain/kotlin/plus/rua/project/ui/CalendarPager.kt | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/shared/src/commonMain/kotlin/plus/rua/project/ui/CalendarMonthView.kt b/shared/src/commonMain/kotlin/plus/rua/project/ui/CalendarMonthView.kt index 99ac3a4..955ff3a 100644 --- a/shared/src/commonMain/kotlin/plus/rua/project/ui/CalendarMonthView.kt +++ b/shared/src/commonMain/kotlin/plus/rua/project/ui/CalendarMonthView.kt @@ -169,6 +169,7 @@ fun CalendarMonthView( currentMonth = month }, collapseProgress = viewModel.collapseProgress, + rowHeightPx = rowHeightPx, onWeeksChanged = { weeks -> currentWeeksCount = weeks if (p < 0.01f) expandedWeeksCount = weeks diff --git a/shared/src/commonMain/kotlin/plus/rua/project/ui/CalendarPager.kt b/shared/src/commonMain/kotlin/plus/rua/project/ui/CalendarPager.kt index 4de3366..28031a4 100644 --- a/shared/src/commonMain/kotlin/plus/rua/project/ui/CalendarPager.kt +++ b/shared/src/commonMain/kotlin/plus/rua/project/ui/CalendarPager.kt @@ -27,6 +27,7 @@ private const val START_PAGE = Int.MAX_VALUE / 2 * @param onDateClick 日期点击回调 * @param onMonthChanged 月份切换回调,滑动到新月份时触发 * @param collapseProgress 折叠进度,0f=展开,1f=折叠 + * @param rowHeightPx 从外层传入的锁定行高(像素),折叠过程中不变 * @param modifier 外部布局修饰符 */ @Composable @@ -36,8 +37,8 @@ fun CalendarPager( onDateClick: (LocalDate) -> Unit, onMonthChanged: (year: Int, month: Int) -> Unit, collapseProgress: Float, + rowHeightPx: Int, onWeeksChanged: ((Int) -> Unit)? = null, - onRowHeightMeasured: ((Int) -> Unit)? = null, pagerState: PagerState, modifier: Modifier = Modifier ) { @@ -79,7 +80,7 @@ fun CalendarPager( } }, collapseProgress = collapseProgress, - onRowHeightMeasured = if (page == pagerState.currentPage) onRowHeightMeasured else null + rowHeightPx = rowHeightPx ) } }