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:
parent
9d0d8bbfb0
commit
557390068e
@ -48,19 +48,20 @@ fun AboutScreen(
|
|||||||
title = { Text("关于鸭鸭日历") },
|
title = { Text("关于鸭鸭日历") },
|
||||||
navigationIcon = {
|
navigationIcon = {
|
||||||
IconButton(onClick = onBack) {
|
IconButton(onClick = onBack) {
|
||||||
|
val arrowColor = MaterialTheme.colorScheme.onSurface
|
||||||
Canvas(modifier = Modifier.size(24.dp)) {
|
Canvas(modifier = Modifier.size(24.dp)) {
|
||||||
val strokeWidth = 2.dp.toPx()
|
val strokeWidth = 2.dp.toPx()
|
||||||
drawLine(
|
drawLine(
|
||||||
color = Color.White,
|
color = arrowColor,
|
||||||
start = Offset(size.width * 0.75f, size.height * 0.25f),
|
start = Offset(size.width * 0.75f, size.height * 0.15f),
|
||||||
end = Offset(size.width * 0.25f, size.height * 0.5f),
|
end = Offset(size.width * 0.25f, size.height * 0.5f),
|
||||||
strokeWidth = strokeWidth,
|
strokeWidth = strokeWidth,
|
||||||
cap = StrokeCap.Round
|
cap = StrokeCap.Round
|
||||||
)
|
)
|
||||||
drawLine(
|
drawLine(
|
||||||
color = Color.White,
|
color = arrowColor,
|
||||||
start = Offset(size.width * 0.25f, size.height * 0.5f),
|
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,
|
strokeWidth = strokeWidth,
|
||||||
cap = StrokeCap.Round
|
cap = StrokeCap.Round
|
||||||
)
|
)
|
||||||
|
|||||||
@ -281,7 +281,8 @@ fun CalendarMonthView(
|
|||||||
containerColor = MaterialTheme.colorScheme.primaryContainer,
|
containerColor = MaterialTheme.colorScheme.primaryContainer,
|
||||||
contentColor = MaterialTheme.colorScheme.onPrimaryContainer
|
contentColor = MaterialTheme.colorScheme.onPrimaryContainer
|
||||||
) {
|
) {
|
||||||
MenuIcon()
|
val iconColor = MaterialTheme.colorScheme.onPrimaryContainer
|
||||||
|
MenuIcon(color = iconColor)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Scrim:全透明,仅拦截点击关闭菜单,无动画
|
// Scrim:全透明,仅拦截点击关闭菜单,无动画
|
||||||
@ -358,7 +359,7 @@ fun CalendarMonthView(
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun MenuIcon(modifier: Modifier = Modifier) {
|
private fun MenuIcon(color: Color, modifier: Modifier = Modifier) {
|
||||||
Canvas(modifier = modifier.size(24.dp)) {
|
Canvas(modifier = modifier.size(24.dp)) {
|
||||||
val strokeWidth = 2.dp.toPx()
|
val strokeWidth = 2.dp.toPx()
|
||||||
val lineSpacing = 4.dp.toPx()
|
val lineSpacing = 4.dp.toPx()
|
||||||
@ -366,7 +367,7 @@ private fun MenuIcon(modifier: Modifier = Modifier) {
|
|||||||
val startY = (size.height - totalHeight) / 2
|
val startY = (size.height - totalHeight) / 2
|
||||||
repeat(3) { i ->
|
repeat(3) { i ->
|
||||||
drawLine(
|
drawLine(
|
||||||
color = Color.White,
|
color = color,
|
||||||
start = Offset(0f, startY + i * (strokeWidth + lineSpacing)),
|
start = Offset(0f, startY + i * (strokeWidth + lineSpacing)),
|
||||||
end = Offset(size.width, startY + i * (strokeWidth + lineSpacing)),
|
end = Offset(size.width, startY + i * (strokeWidth + lineSpacing)),
|
||||||
strokeWidth = strokeWidth
|
strokeWidth = strokeWidth
|
||||||
|
|||||||
@ -41,19 +41,20 @@ fun LicensesScreen(
|
|||||||
title = { Text("开放源代码许可") },
|
title = { Text("开放源代码许可") },
|
||||||
navigationIcon = {
|
navigationIcon = {
|
||||||
IconButton(onClick = onBack) {
|
IconButton(onClick = onBack) {
|
||||||
|
val arrowColor = MaterialTheme.colorScheme.onSurface
|
||||||
Canvas(modifier = Modifier.size(24.dp)) {
|
Canvas(modifier = Modifier.size(24.dp)) {
|
||||||
val strokeWidth = 2.dp.toPx()
|
val strokeWidth = 2.dp.toPx()
|
||||||
drawLine(
|
drawLine(
|
||||||
color = Color.White,
|
color = arrowColor,
|
||||||
start = Offset(size.width * 0.75f, size.height * 0.25f),
|
start = Offset(size.width * 0.75f, size.height * 0.15f),
|
||||||
end = Offset(size.width * 0.25f, size.height * 0.5f),
|
end = Offset(size.width * 0.25f, size.height * 0.5f),
|
||||||
strokeWidth = strokeWidth,
|
strokeWidth = strokeWidth,
|
||||||
cap = StrokeCap.Round
|
cap = StrokeCap.Round
|
||||||
)
|
)
|
||||||
drawLine(
|
drawLine(
|
||||||
color = Color.White,
|
color = arrowColor,
|
||||||
start = Offset(size.width * 0.25f, size.height * 0.5f),
|
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,
|
strokeWidth = strokeWidth,
|
||||||
cap = StrokeCap.Round
|
cap = StrokeCap.Round
|
||||||
)
|
)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user