feat: 个人排班标记改为淡色圆形底+居中文字
- showLegalHoliday=true 时左上角标记改为 16dp 圆形淡色底 背景 alpha 0.12,文字用原色居中 - showLegalHoliday=false 时保持右上角无背景直接浮于单元格 - 移除不再使用的 RoundedCornerShape import Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
7f639f6c24
commit
b1185da27a
@ -12,8 +12,8 @@ import androidx.compose.foundation.layout.Column
|
|||||||
import androidx.compose.foundation.layout.aspectRatio
|
import androidx.compose.foundation.layout.aspectRatio
|
||||||
import androidx.compose.foundation.layout.fillMaxSize
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
|
import androidx.compose.foundation.layout.size
|
||||||
import androidx.compose.foundation.shape.CircleShape
|
import androidx.compose.foundation.shape.CircleShape
|
||||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
|
||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
@ -229,41 +229,39 @@ fun DayCell(
|
|||||||
} else {
|
} else {
|
||||||
MaterialTheme.colorScheme.error
|
MaterialTheme.colorScheme.error
|
||||||
}
|
}
|
||||||
val shiftOnAccentColor = if (shiftKind == ShiftKind.WORK) {
|
|
||||||
MaterialTheme.colorScheme.onPrimary
|
|
||||||
} else {
|
|
||||||
MaterialTheme.colorScheme.onError
|
|
||||||
}
|
|
||||||
val shiftLabel = if (shiftKind == ShiftKind.WORK) "班" else "休"
|
val shiftLabel = if (shiftKind == ShiftKind.WORK) "班" else "休"
|
||||||
val shiftAlpha = if (isCurrentMonth) 1f else 0.38f
|
val shiftAlpha = if (isCurrentMonth) 1f else 0.38f
|
||||||
// 右上角(默认)无背景,文字直接浮在单元格上;
|
if (showLegalHoliday) {
|
||||||
// 左上角(showLegalHoliday=true 时)用实心胶囊,与右上角法定调休区分。
|
Box(
|
||||||
val shiftFgColor = if (showLegalHoliday) shiftOnAccentColor else shiftAccentColor
|
modifier = Modifier
|
||||||
val shiftAlignment = if (showLegalHoliday) Alignment.TopStart else Alignment.TopEnd
|
.align(Alignment.TopStart)
|
||||||
val shiftPadding = if (showLegalHoliday) {
|
.zIndex(1f)
|
||||||
Modifier.padding(top = 1.dp, start = 2.dp)
|
.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 {
|
} else {
|
||||||
Modifier.padding(top = 1.dp, end = 2.dp)
|
Text(
|
||||||
}
|
text = shiftLabel,
|
||||||
val shiftBackground = if (showLegalHoliday) {
|
color = shiftAccentColor.copy(alpha = shiftAlpha),
|
||||||
Modifier.background(
|
fontSize = 9.sp,
|
||||||
shiftAccentColor.copy(alpha = shiftAlpha),
|
fontWeight = FontWeight.Bold,
|
||||||
RoundedCornerShape(4.dp)
|
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) {
|
if (showLegalHoliday && holidayBadge != null) {
|
||||||
Text(
|
Text(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user