Fix BottomCard positioning by tracking expanded calendar height separately

Use expandedCalendarHeightPx to preserve full height during collapse animation,
and compute cardTopPx based on collapse state instead of offset arithmetic.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
xfy 2026-05-14 15:13:45 +08:00
parent 6c3e773a38
commit 0b9a516ed3

View File

@ -38,8 +38,18 @@ fun CalendarMonthView(
var calendarHeightPx by remember { mutableIntStateOf(0) }
var screenHeightPx by remember { mutableIntStateOf(0) }
val collapseOffsetPx = -(viewModel.collapseProgress * calendarHeightPx * 5f / 6f).toInt()
val cardTopPx = calendarHeightPx + collapseOffsetPx
var expandedCalendarHeightPx by remember { mutableIntStateOf(0) }
val collapseOffsetPx = if (viewModel.isCollapsed) {
0
} else {
-(viewModel.collapseProgress * expandedCalendarHeightPx * 5f / 6f).toInt()
}
val cardTopPx = if (viewModel.isCollapsed) {
calendarHeightPx
} else {
expandedCalendarHeightPx + collapseOffsetPx
}
val cardHeightPx = screenHeightPx - cardTopPx
Box(
@ -52,6 +62,9 @@ fun CalendarMonthView(
) {
Column(modifier = Modifier.padding(horizontal = 16.dp).onSizeChanged { size ->
calendarHeightPx = size.height
if (!viewModel.isCollapsed && viewModel.collapseProgress < 0.01f) {
expandedCalendarHeightPx = size.height
}
}) {
MonthHeader(
year = currentYear,