fix: 年视图 MiniMonth 添加标题与星期行间距

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
xfy 2026-05-19 15:50:46 +08:00
parent fb52d30509
commit 19ae5b6b52

View File

@ -193,10 +193,11 @@ private fun MiniMonth(
val density = LocalDensity.current val density = LocalDensity.current
val dayRowCount = days.size / 7 val dayRowCount = days.size / 7
val titleHeightPx = with(density) { 14.sp.toPx() } val titleHeightPx = with(density) { 14.sp.toPx() }
val titleToWeekdayGapPx = with(density) { 4.dp.toPx() }
val weekdayHeightPx = with(density) { 12.sp.toPx() } val weekdayHeightPx = with(density) { 12.sp.toPx() }
val dayCellHeightPx = with(density) { (12.sp.toPx() + 4.dp.toPx()) } val dayCellHeightPx = with(density) { (12.sp.toPx() + 4.dp.toPx()) }
val totalHeight = with(density) { val totalHeight = with(density) {
(titleHeightPx + weekdayHeightPx + dayRowCount * dayCellHeightPx).toDp() (titleHeightPx + titleToWeekdayGapPx + weekdayHeightPx + dayRowCount * dayCellHeightPx).toDp()
} }
Column( Column(
@ -220,7 +221,7 @@ private fun MiniMonth(
) )
// 2. 绘制星期行 // 2. 绘制星期行
val weekdayY = titleHeightPx val weekdayY = titleHeightPx + titleToWeekdayGapPx
WEEKDAY_LABELS.forEachIndexed { i, label -> WEEKDAY_LABELS.forEachIndexed { i, label ->
val layout = weekdayLayouts[label]!! val layout = weekdayLayouts[label]!!
drawText( drawText(
@ -233,7 +234,7 @@ private fun MiniMonth(
} }
// 3. 绘制日期网格 // 3. 绘制日期网格
val dayGridY = titleHeightPx + weekdayHeightPx val dayGridY = weekdayY + weekdayHeightPx
days.forEachIndexed { index, dayData -> days.forEachIndexed { index, dayData ->
val row = index / 7 val row = index / 7