fix: 图标颜色适配 MaterialTheme 主题色

将 AboutScreen、LicensesScreen 返回箭头和 CalendarMonthView 菜单图标的
硬编码 Color.White 替换为 MaterialTheme.colorScheme 对应主题色,
使图标在深色/浅色主题下均能正确显示。

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
xfy 2026-05-20 00:41:21 +08:00
parent 9d0d8bbfb0
commit 557390068e
3 changed files with 14 additions and 11 deletions

View File

@ -48,19 +48,20 @@ fun AboutScreen(
title = { Text("关于鸭鸭日历") },
navigationIcon = {
IconButton(onClick = onBack) {
val arrowColor = MaterialTheme.colorScheme.onSurface
Canvas(modifier = Modifier.size(24.dp)) {
val strokeWidth = 2.dp.toPx()
drawLine(
color = Color.White,
start = Offset(size.width * 0.75f, size.height * 0.25f),
color = arrowColor,
start = Offset(size.width * 0.75f, size.height * 0.15f),
end = Offset(size.width * 0.25f, size.height * 0.5f),
strokeWidth = strokeWidth,
cap = StrokeCap.Round
)
drawLine(
color = Color.White,
color = arrowColor,
start = Offset(size.width * 0.25f, size.height * 0.5f),
end = Offset(size.width * 0.75f, size.height * 0.75f),
end = Offset(size.width * 0.75f, size.height * 0.85f),
strokeWidth = strokeWidth,
cap = StrokeCap.Round
)

View File

@ -281,7 +281,8 @@ fun CalendarMonthView(
containerColor = MaterialTheme.colorScheme.primaryContainer,
contentColor = MaterialTheme.colorScheme.onPrimaryContainer
) {
MenuIcon()
val iconColor = MaterialTheme.colorScheme.onPrimaryContainer
MenuIcon(color = iconColor)
}
// Scrim全透明仅拦截点击关闭菜单无动画
@ -358,7 +359,7 @@ fun CalendarMonthView(
}
@Composable
private fun MenuIcon(modifier: Modifier = Modifier) {
private fun MenuIcon(color: Color, modifier: Modifier = Modifier) {
Canvas(modifier = modifier.size(24.dp)) {
val strokeWidth = 2.dp.toPx()
val lineSpacing = 4.dp.toPx()
@ -366,7 +367,7 @@ private fun MenuIcon(modifier: Modifier = Modifier) {
val startY = (size.height - totalHeight) / 2
repeat(3) { i ->
drawLine(
color = Color.White,
color = color,
start = Offset(0f, startY + i * (strokeWidth + lineSpacing)),
end = Offset(size.width, startY + i * (strokeWidth + lineSpacing)),
strokeWidth = strokeWidth

View File

@ -41,19 +41,20 @@ fun LicensesScreen(
title = { Text("开放源代码许可") },
navigationIcon = {
IconButton(onClick = onBack) {
val arrowColor = MaterialTheme.colorScheme.onSurface
Canvas(modifier = Modifier.size(24.dp)) {
val strokeWidth = 2.dp.toPx()
drawLine(
color = Color.White,
start = Offset(size.width * 0.75f, size.height * 0.25f),
color = arrowColor,
start = Offset(size.width * 0.75f, size.height * 0.15f),
end = Offset(size.width * 0.25f, size.height * 0.5f),
strokeWidth = strokeWidth,
cap = StrokeCap.Round
)
drawLine(
color = Color.White,
color = arrowColor,
start = Offset(size.width * 0.25f, size.height * 0.5f),
end = Offset(size.width * 0.75f, size.height * 0.75f),
end = Offset(size.width * 0.75f, size.height * 0.85f),
strokeWidth = strokeWidth,
cap = StrokeCap.Round
)