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:
parent
1db84d2d0e
commit
5087bceb51
@ -61,6 +61,7 @@ fun CalendarMonthView(
|
|||||||
val p = viewModel.collapseProgress
|
val p = viewModel.collapseProgress
|
||||||
val headerHeightPx = monthHeaderHeightPx + weekdayHeaderHeightPx
|
val headerHeightPx = monthHeaderHeightPx + weekdayHeaderHeightPx
|
||||||
val rowPaddingPx = with(density) { ROW_PADDING_DP.dp.toPx() }.toInt()
|
val rowPaddingPx = with(density) { ROW_PADDING_DP.dp.toPx() }.toInt()
|
||||||
|
val cardGapPx = with(density) { CARD_GAP_DP.dp.toPx() }.toInt()
|
||||||
|
|
||||||
val interpolatedWeeks by remember {
|
val interpolatedWeeks by remember {
|
||||||
derivedStateOf {
|
derivedStateOf {
|
||||||
@ -102,7 +103,7 @@ fun CalendarMonthView(
|
|||||||
}
|
}
|
||||||
} else 0
|
} else 0
|
||||||
|
|
||||||
val calendarAreaHeightPx = headerHeightPx + gridHeightPx + rowPaddingPx
|
val calendarAreaHeightPx = headerHeightPx + gridHeightPx + rowPaddingPx + cardGapPx
|
||||||
val cardHeightPx = if (screenHeightPx > 0 && calendarAreaHeightPx > 0) screenHeightPx - calendarAreaHeightPx else 0
|
val cardHeightPx = if (screenHeightPx > 0 && calendarAreaHeightPx > 0) screenHeightPx - calendarAreaHeightPx else 0
|
||||||
|
|
||||||
// 当 rowHeightPx 已知时,用计算的高度约束 pager;否则让 pager 自由扩展以测量行高
|
// 当 rowHeightPx 已知时,用计算的高度约束 pager;否则让 pager 自由扩展以测量行高
|
||||||
|
|||||||
@ -24,6 +24,9 @@ const val HORIZONTAL_PADDING_DP = 16
|
|||||||
/** BottomCard 拖拽手势范围 (dp) */
|
/** BottomCard 拖拽手势范围 (dp) */
|
||||||
const val DRAG_RANGE_DP = 200
|
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
|
fun lerp(start: Float, end: Float, fraction: Float): Float = start + (end - start) * fraction
|
||||||
|
|
||||||
|
|||||||
@ -30,7 +30,7 @@ fun MonthHeader(
|
|||||||
Row(
|
Row(
|
||||||
modifier = modifier
|
modifier = modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.padding(vertical = 14.dp),
|
.padding(vertical = 14.dp, horizontal = 12.dp),
|
||||||
verticalAlignment = Alignment.CenterVertically
|
verticalAlignment = Alignment.CenterVertically
|
||||||
) {
|
) {
|
||||||
Text(
|
Text(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user