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 <noreply@anthropic.com>
This commit is contained in:
xfy 2026-05-15 00:20:23 +08:00
parent 7e2bb048f6
commit 266c3eede1
2 changed files with 4 additions and 2 deletions

View File

@ -169,6 +169,7 @@ fun CalendarMonthView(
currentMonth = month
},
collapseProgress = viewModel.collapseProgress,
rowHeightPx = rowHeightPx,
onWeeksChanged = { weeks ->
currentWeeksCount = weeks
if (p < 0.01f) expandedWeeksCount = weeks

View File

@ -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
)
}
}