fix:修复深色模式的 bug

This commit is contained in:
amos
2025-12-18 17:00:05 +08:00
parent 3fcd90aa65
commit 2f8c1c4931
2 changed files with 29 additions and 27 deletions

View File

@@ -54,7 +54,7 @@ fun CreatePostScreen(
Column(
modifier = Modifier
.fillMaxSize()
.background(Color.White)
.background(MaterialTheme.colorScheme.background)
) {
// Header
Row(
@@ -74,7 +74,7 @@ fun CreatePostScreen(
Icon(
Icons.Default.Close,
contentDescription = "关闭",
tint = Slate900,
tint = MaterialTheme.colorScheme.onBackground,
modifier = Modifier.size(28.dp)
)
}
@@ -124,7 +124,7 @@ fun CreatePostScreen(
modifier = Modifier
.size(40.dp)
.clip(CircleShape)
.background(Slate100),
.background(MaterialTheme.colorScheme.surfaceVariant),
contentAlignment = Alignment.Center
) {
if (user?.avatarUrl?.isNotEmpty() == true) {
@@ -137,7 +137,7 @@ fun CreatePostScreen(
} else {
Text(
text = user?.nickname?.firstOrNull()?.toString() ?: "?",
color = Slate600,
color = MaterialTheme.colorScheme.onSurfaceVariant,
fontWeight = FontWeight.Bold,
fontSize = 16.sp
)
@@ -154,7 +154,7 @@ fun CreatePostScreen(
placeholder = {
Text(
"有什么新鲜事?",
color = Slate300,
color = MaterialTheme.colorScheme.onSurfaceVariant,
fontSize = 18.sp
)
},
@@ -164,12 +164,13 @@ fun CreatePostScreen(
unfocusedContainerColor = Color.Transparent,
focusedIndicatorColor = Color.Transparent,
unfocusedIndicatorColor = Color.Transparent,
cursorColor = Brand500
cursorColor = Brand500,
focusedTextColor = MaterialTheme.colorScheme.onBackground,
unfocusedTextColor = MaterialTheme.colorScheme.onBackground
),
textStyle = LocalTextStyle.current.copy(
fontSize = 18.sp,
lineHeight = 26.sp,
color = Slate800
lineHeight = 26.sp
)
)
@@ -213,7 +214,7 @@ fun CreatePostScreen(
}
// Bottom Toolbar
HorizontalDivider(color = Slate50, thickness = 1.dp)
HorizontalDivider(color = MaterialTheme.colorScheme.outlineVariant, thickness = 1.dp)
Row(
modifier = Modifier
.fillMaxWidth()
@@ -232,7 +233,7 @@ fun CreatePostScreen(
Icon(
Icons.Outlined.Image,
contentDescription = "添加图片",
tint = if (selectedImages.size < 4) Brand500 else Slate300,
tint = if (selectedImages.size < 4) Brand500 else MaterialTheme.colorScheme.onSurfaceVariant,
modifier = Modifier.size(24.dp)
)
}
@@ -263,9 +264,9 @@ fun CreatePostScreen(
content.length > 260 -> ErrorRed
content.length > 240 -> WarningOrange
content.length > 0 -> Brand500
else -> Slate200
else -> MaterialTheme.colorScheme.outlineVariant
},
trackColor = Slate100,
trackColor = MaterialTheme.colorScheme.surfaceVariant,
strokeWidth = 2.dp
)
}
@@ -310,7 +311,7 @@ private fun CreatePostEmojiPicker(
) {
Surface(
shape = RoundedCornerShape(28.dp),
color = Color.White,
color = MaterialTheme.colorScheme.surface,
shadowElevation = 16.dp,
modifier = Modifier
.fillMaxWidth()
@@ -335,7 +336,7 @@ private fun CreatePostEmojiPicker(
text = "选择表情",
fontWeight = FontWeight.Bold,
fontSize = 20.sp,
color = Slate900
color = MaterialTheme.colorScheme.onSurface
)
Spacer(modifier = Modifier.weight(1f))
IconButton(
@@ -345,7 +346,7 @@ private fun CreatePostEmojiPicker(
Icon(
imageVector = Icons.Filled.Close,
contentDescription = "关闭",
tint = Slate400,
tint = MaterialTheme.colorScheme.onSurfaceVariant,
modifier = Modifier.size(20.dp)
)
}

View File

@@ -58,7 +58,7 @@ fun EditPostScreen(
Column(
modifier = Modifier
.fillMaxSize()
.background(Color.White)
.background(MaterialTheme.colorScheme.background)
) {
// Header
Row(
@@ -77,7 +77,7 @@ fun EditPostScreen(
Icon(
Icons.Default.Close,
contentDescription = "关闭",
tint = Slate900,
tint = MaterialTheme.colorScheme.onBackground,
modifier = Modifier.size(28.dp)
)
}
@@ -117,7 +117,7 @@ fun EditPostScreen(
modifier = Modifier
.size(40.dp)
.clip(CircleShape)
.background(Slate100),
.background(MaterialTheme.colorScheme.surfaceVariant),
contentAlignment = Alignment.Center
) {
if (post.user?.avatarUrl?.isNotEmpty() == true) {
@@ -130,7 +130,7 @@ fun EditPostScreen(
} else {
Text(
text = post.user?.nickname?.firstOrNull()?.toString() ?: "?",
color = Slate600,
color = MaterialTheme.colorScheme.onSurfaceVariant,
fontWeight = FontWeight.Bold,
fontSize = 16.sp
)
@@ -143,19 +143,20 @@ fun EditPostScreen(
TextField(
value = content,
onValueChange = { content = it },
placeholder = { Text("有什么新鲜事?", color = Slate300, fontSize = 18.sp) },
placeholder = { Text("有什么新鲜事?", color = MaterialTheme.colorScheme.onSurfaceVariant, fontSize = 18.sp) },
modifier = Modifier.fillMaxWidth(),
colors = TextFieldDefaults.colors(
focusedContainerColor = Color.Transparent,
unfocusedContainerColor = Color.Transparent,
focusedIndicatorColor = Color.Transparent,
unfocusedIndicatorColor = Color.Transparent,
cursorColor = Brand500
cursorColor = Brand500,
focusedTextColor = MaterialTheme.colorScheme.onBackground,
unfocusedTextColor = MaterialTheme.colorScheme.onBackground
),
textStyle = LocalTextStyle.current.copy(
fontSize = 18.sp,
lineHeight = 26.sp,
color = Slate800
lineHeight = 26.sp
)
)
@@ -229,7 +230,7 @@ fun EditPostScreen(
}
// Bottom Toolbar
HorizontalDivider(color = Slate50, thickness = 1.dp)
HorizontalDivider(color = MaterialTheme.colorScheme.outlineVariant, thickness = 1.dp)
Row(
modifier = Modifier
.fillMaxWidth()
@@ -302,7 +303,7 @@ private fun EditPostEmojiPicker(
) {
Surface(
shape = RoundedCornerShape(28.dp),
color = Color.White,
color = MaterialTheme.colorScheme.surface,
shadowElevation = 16.dp,
modifier = Modifier
.fillMaxWidth()
@@ -326,7 +327,7 @@ private fun EditPostEmojiPicker(
text = "选择表情",
fontWeight = FontWeight.Bold,
fontSize = 20.sp,
color = Slate900
color = MaterialTheme.colorScheme.onSurface
)
Spacer(modifier = Modifier.weight(1f))
IconButton(
@@ -336,7 +337,7 @@ private fun EditPostEmojiPicker(
Icon(
imageVector = Icons.Default.Close,
contentDescription = "关闭",
tint = Slate400,
tint = MaterialTheme.colorScheme.onSurfaceVariant,
modifier = Modifier.size(20.dp)
)
}