From b1185da27ac2d338a02ec670536195bcbda3db3a Mon Sep 17 00:00:00 2001 From: xfy Date: Mon, 25 May 2026 00:01:57 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=B8=AA=E4=BA=BA=E6=8E=92=E7=8F=AD?= =?UTF-8?q?=E6=A0=87=E8=AE=B0=E6=94=B9=E4=B8=BA=E6=B7=A1=E8=89=B2=E5=9C=86?= =?UTF-8?q?=E5=BD=A2=E5=BA=95+=E5=B1=85=E4=B8=AD=E6=96=87=E5=AD=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - showLegalHoliday=true 时左上角标记改为 16dp 圆形淡色底 背景 alpha 0.12,文字用原色居中 - showLegalHoliday=false 时保持右上角无背景直接浮于单元格 - 移除不再使用的 RoundedCornerShape import Co-Authored-By: Claude Opus 4.7 (1M context) --- .../kotlin/plus/rua/project/ui/DayCell.kt | 62 +++++++++---------- 1 file changed, 30 insertions(+), 32 deletions(-) diff --git a/core/src/main/kotlin/plus/rua/project/ui/DayCell.kt b/core/src/main/kotlin/plus/rua/project/ui/DayCell.kt index 6d1990d..2750318 100644 --- a/core/src/main/kotlin/plus/rua/project/ui/DayCell.kt +++ b/core/src/main/kotlin/plus/rua/project/ui/DayCell.kt @@ -12,8 +12,8 @@ import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.aspectRatio import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.size import androidx.compose.foundation.shape.CircleShape -import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.runtime.Composable @@ -229,41 +229,39 @@ fun DayCell( } else { MaterialTheme.colorScheme.error } - val shiftOnAccentColor = if (shiftKind == ShiftKind.WORK) { - MaterialTheme.colorScheme.onPrimary - } else { - MaterialTheme.colorScheme.onError - } val shiftLabel = if (shiftKind == ShiftKind.WORK) "班" else "休" val shiftAlpha = if (isCurrentMonth) 1f else 0.38f - // 右上角(默认)无背景,文字直接浮在单元格上; - // 左上角(showLegalHoliday=true 时)用实心胶囊,与右上角法定调休区分。 - val shiftFgColor = if (showLegalHoliday) shiftOnAccentColor else shiftAccentColor - val shiftAlignment = if (showLegalHoliday) Alignment.TopStart else Alignment.TopEnd - val shiftPadding = if (showLegalHoliday) { - Modifier.padding(top = 1.dp, start = 2.dp) + if (showLegalHoliday) { + Box( + modifier = Modifier + .align(Alignment.TopStart) + .zIndex(1f) + .padding(top = 1.dp, start = 2.dp) + .background(shiftAccentColor.copy(alpha = 0.12f), CircleShape) + .size(16.dp), + contentAlignment = Alignment.Center + ) { + Text( + text = shiftLabel, + color = shiftAccentColor.copy(alpha = shiftAlpha), + fontSize = 9.sp, + fontWeight = FontWeight.Bold, + lineHeight = 9.sp + ) + } } else { - Modifier.padding(top = 1.dp, end = 2.dp) - } - val shiftBackground = if (showLegalHoliday) { - Modifier.background( - shiftAccentColor.copy(alpha = shiftAlpha), - RoundedCornerShape(4.dp) + Text( + text = shiftLabel, + color = shiftAccentColor.copy(alpha = shiftAlpha), + fontSize = 9.sp, + fontWeight = FontWeight.Bold, + lineHeight = 9.sp, + modifier = Modifier + .align(Alignment.TopEnd) + .zIndex(1f) + .padding(top = 1.dp, end = 2.dp) ) - } else Modifier - Text( - text = shiftLabel, - color = shiftFgColor.copy(alpha = shiftAlpha), - fontSize = 9.sp, - fontWeight = FontWeight.Bold, - lineHeight = 9.sp, - modifier = Modifier - .align(shiftAlignment) - .zIndex(1f) - .then(shiftBackground) - .then(shiftPadding) - .padding(horizontal = 3.dp, vertical = 1.dp) - ) + } } if (showLegalHoliday && holidayBadge != null) { Text(