Add card gap spacing and header horizontal padding

Include CARD_GAP_DP in calendar area height calculation so BottomCard
positioning accounts for the gap. Add horizontal padding to MonthHeader
for better visual alignment.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
xfy 2026-05-15 14:05:44 +08:00
parent 1db84d2d0e
commit 5087bceb51
3 changed files with 6 additions and 2 deletions

View File

@ -61,6 +61,7 @@ fun CalendarMonthView(
val p = viewModel.collapseProgress
val headerHeightPx = monthHeaderHeightPx + weekdayHeaderHeightPx
val rowPaddingPx = with(density) { ROW_PADDING_DP.dp.toPx() }.toInt()
val cardGapPx = with(density) { CARD_GAP_DP.dp.toPx() }.toInt()
val interpolatedWeeks by remember {
derivedStateOf {
@ -102,7 +103,7 @@ fun CalendarMonthView(
}
} else 0
val calendarAreaHeightPx = headerHeightPx + gridHeightPx + rowPaddingPx
val calendarAreaHeightPx = headerHeightPx + gridHeightPx + rowPaddingPx + cardGapPx
val cardHeightPx = if (screenHeightPx > 0 && calendarAreaHeightPx > 0) screenHeightPx - calendarAreaHeightPx else 0
// 当 rowHeightPx 已知时,用计算的高度约束 pager否则让 pager 自由扩展以测量行高

View File

@ -24,6 +24,9 @@ const val HORIZONTAL_PADDING_DP = 16
/** BottomCard 拖拽手势范围 (dp) */
const val DRAG_RANGE_DP = 200
/** 日历与 BottomCard 之间的间距 (dp) */
const val CARD_GAP_DP = 12
/** 线性插值 */
fun lerp(start: Float, end: Float, fraction: Float): Float = start + (end - start) * fraction

View File

@ -30,7 +30,7 @@ fun MonthHeader(
Row(
modifier = modifier
.fillMaxWidth()
.padding(vertical = 14.dp),
.padding(vertical = 14.dp, horizontal = 12.dp),
verticalAlignment = Alignment.CenterVertically
) {
Text(