From 5087bceb5165fdfa14e2d1860ea13269b126b169 Mon Sep 17 00:00:00 2001 From: xfy Date: Fri, 15 May 2026 14:05:44 +0800 Subject: [PATCH] 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 --- .../commonMain/kotlin/plus/rua/project/ui/CalendarMonthView.kt | 3 ++- .../src/commonMain/kotlin/plus/rua/project/ui/CalendarUtils.kt | 3 +++ .../src/commonMain/kotlin/plus/rua/project/ui/MonthHeader.kt | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/shared/src/commonMain/kotlin/plus/rua/project/ui/CalendarMonthView.kt b/shared/src/commonMain/kotlin/plus/rua/project/ui/CalendarMonthView.kt index b780b47..cff540d 100644 --- a/shared/src/commonMain/kotlin/plus/rua/project/ui/CalendarMonthView.kt +++ b/shared/src/commonMain/kotlin/plus/rua/project/ui/CalendarMonthView.kt @@ -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 自由扩展以测量行高 diff --git a/shared/src/commonMain/kotlin/plus/rua/project/ui/CalendarUtils.kt b/shared/src/commonMain/kotlin/plus/rua/project/ui/CalendarUtils.kt index 5e8fa58..559b531 100644 --- a/shared/src/commonMain/kotlin/plus/rua/project/ui/CalendarUtils.kt +++ b/shared/src/commonMain/kotlin/plus/rua/project/ui/CalendarUtils.kt @@ -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 diff --git a/shared/src/commonMain/kotlin/plus/rua/project/ui/MonthHeader.kt b/shared/src/commonMain/kotlin/plus/rua/project/ui/MonthHeader.kt index 812af31..71c9e97 100644 --- a/shared/src/commonMain/kotlin/plus/rua/project/ui/MonthHeader.kt +++ b/shared/src/commonMain/kotlin/plus/rua/project/ui/MonthHeader.kt @@ -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(