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:
parent
6c3e773a38
commit
0b9a516ed3
@ -38,8 +38,18 @@ fun CalendarMonthView(
|
|||||||
|
|
||||||
var calendarHeightPx by remember { mutableIntStateOf(0) }
|
var calendarHeightPx by remember { mutableIntStateOf(0) }
|
||||||
var screenHeightPx by remember { mutableIntStateOf(0) }
|
var screenHeightPx by remember { mutableIntStateOf(0) }
|
||||||
val collapseOffsetPx = -(viewModel.collapseProgress * calendarHeightPx * 5f / 6f).toInt()
|
var expandedCalendarHeightPx by remember { mutableIntStateOf(0) }
|
||||||
val cardTopPx = calendarHeightPx + collapseOffsetPx
|
|
||||||
|
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
|
val cardHeightPx = screenHeightPx - cardTopPx
|
||||||
|
|
||||||
Box(
|
Box(
|
||||||
@ -52,6 +62,9 @@ fun CalendarMonthView(
|
|||||||
) {
|
) {
|
||||||
Column(modifier = Modifier.padding(horizontal = 16.dp).onSizeChanged { size ->
|
Column(modifier = Modifier.padding(horizontal = 16.dp).onSizeChanged { size ->
|
||||||
calendarHeightPx = size.height
|
calendarHeightPx = size.height
|
||||||
|
if (!viewModel.isCollapsed && viewModel.collapseProgress < 0.01f) {
|
||||||
|
expandedCalendarHeightPx = size.height
|
||||||
|
}
|
||||||
}) {
|
}) {
|
||||||
MonthHeader(
|
MonthHeader(
|
||||||
year = currentYear,
|
year = currentYear,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user