Simplify BottomCard positioning with cardTopPx calculation instead of offset

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
xfy 2026-05-14 14:48:05 +08:00
parent 0bc5057986
commit f64a1c1851

View File

@ -39,7 +39,8 @@ fun CalendarMonthView(
var calendarHeightPx by remember { mutableIntStateOf(0) }
var screenHeightPx by remember { mutableIntStateOf(0) }
val collapseOffsetPx = -(viewModel.collapseProgress * calendarHeightPx * 5f / 6f).toInt()
val cardHeightPx = screenHeightPx - calendarHeightPx + collapseOffsetPx
val cardTopPx = calendarHeightPx + collapseOffsetPx
val cardHeightPx = screenHeightPx - cardTopPx
Box(
modifier = modifier
@ -88,7 +89,6 @@ fun CalendarMonthView(
modifier = Modifier
.fillMaxWidth()
.height(with(density) { cardHeightPx.toDp() })
.offset(y = with(density) { collapseOffsetPx.toDp() })
.align(Alignment.BottomCenter)
)
}