fix:修复深色模式下,登录页面的 bug

This commit is contained in:
amos
2025-12-17 16:38:25 +08:00
parent 149beb7c6d
commit f58df76147

View File

@@ -129,7 +129,7 @@ fun LoginScreen(
Box(
modifier = Modifier
.fillMaxSize()
.background(Color.White),
.background(MaterialTheme.colorScheme.background),
contentAlignment = Alignment.Center
) {
Column(
@@ -153,7 +153,7 @@ fun LoginScreen(
text = "Memory",
fontSize = 30.sp,
fontWeight = FontWeight.Bold,
color = Slate900
color = MaterialTheme.colorScheme.onBackground
)
Spacer(modifier = Modifier.height(8.dp))
@@ -161,7 +161,7 @@ fun LoginScreen(
Text(
text = "记录生活的点点滴滴\nCapture your life.",
fontSize = 14.sp,
color = Slate400,
color = MaterialTheme.colorScheme.onSurfaceVariant,
textAlign = TextAlign.Center,
lineHeight = 20.sp
)
@@ -172,12 +172,12 @@ fun LoginScreen(
OutlinedTextField(
value = username,
onValueChange = { username = it },
placeholder = { Text("用户名", color = Slate400) },
placeholder = { Text("用户名", color = MaterialTheme.colorScheme.onSurfaceVariant) },
leadingIcon = {
Icon(
Icons.Outlined.Person,
contentDescription = null,
tint = Slate400,
tint = MaterialTheme.colorScheme.onSurfaceVariant,
modifier = Modifier.size(20.dp)
)
},
@@ -186,10 +186,12 @@ fun LoginScreen(
.shadow(2.dp, RoundedCornerShape(12.dp)),
shape = RoundedCornerShape(12.dp),
colors = OutlinedTextFieldDefaults.colors(
focusedContainerColor = Slate50,
unfocusedContainerColor = Slate50,
focusedContainerColor = MaterialTheme.colorScheme.surfaceVariant,
unfocusedContainerColor = MaterialTheme.colorScheme.surfaceVariant,
focusedBorderColor = Brand500,
unfocusedBorderColor = Slate100,
unfocusedBorderColor = MaterialTheme.colorScheme.outline,
focusedTextColor = MaterialTheme.colorScheme.onSurface,
unfocusedTextColor = MaterialTheme.colorScheme.onSurface,
cursorColor = Brand500
),
singleLine = true,
@@ -205,12 +207,12 @@ fun LoginScreen(
OutlinedTextField(
value = password,
onValueChange = { password = it },
placeholder = { Text("密码", color = Slate400) },
placeholder = { Text("密码", color = MaterialTheme.colorScheme.onSurfaceVariant) },
leadingIcon = {
Icon(
Icons.Outlined.Lock,
contentDescription = null,
tint = Slate400,
tint = MaterialTheme.colorScheme.onSurfaceVariant,
modifier = Modifier.size(20.dp)
)
},
@@ -219,10 +221,12 @@ fun LoginScreen(
.shadow(2.dp, RoundedCornerShape(12.dp)),
shape = RoundedCornerShape(12.dp),
colors = OutlinedTextFieldDefaults.colors(
focusedContainerColor = Slate50,
unfocusedContainerColor = Slate50,
focusedContainerColor = MaterialTheme.colorScheme.surfaceVariant,
unfocusedContainerColor = MaterialTheme.colorScheme.surfaceVariant,
focusedBorderColor = Brand500,
unfocusedBorderColor = Slate100,
unfocusedBorderColor = MaterialTheme.colorScheme.outline,
focusedTextColor = MaterialTheme.colorScheme.onSurface,
unfocusedTextColor = MaterialTheme.colorScheme.onSurface,
cursorColor = Brand500
),
visualTransformation = PasswordVisualTransformation(),
@@ -253,12 +257,12 @@ fun LoginScreen(
OutlinedTextField(
value = nickname,
onValueChange = { nickname = it },
placeholder = { Text("昵称", color = Slate400) },
placeholder = { Text("昵称", color = MaterialTheme.colorScheme.onSurfaceVariant) },
leadingIcon = {
Icon(
Icons.Outlined.Person,
contentDescription = null,
tint = Slate400,
tint = MaterialTheme.colorScheme.onSurfaceVariant,
modifier = Modifier.size(20.dp)
)
},
@@ -267,10 +271,12 @@ fun LoginScreen(
.shadow(2.dp, RoundedCornerShape(12.dp)),
shape = RoundedCornerShape(12.dp),
colors = OutlinedTextFieldDefaults.colors(
focusedContainerColor = Slate50,
unfocusedContainerColor = Slate50,
focusedContainerColor = MaterialTheme.colorScheme.surfaceVariant,
unfocusedContainerColor = MaterialTheme.colorScheme.surfaceVariant,
focusedBorderColor = Brand500,
unfocusedBorderColor = Slate100,
unfocusedBorderColor = MaterialTheme.colorScheme.outline,
focusedTextColor = MaterialTheme.colorScheme.onSurface,
unfocusedTextColor = MaterialTheme.colorScheme.onSurface,
cursorColor = Brand500
),
singleLine = true,
@@ -350,7 +356,7 @@ fun LoginScreen(
) {
Text(
text = if (isRegisterMode) "已有账号? " else "还没有账号? ",
color = Slate400,
color = MaterialTheme.colorScheme.onSurfaceVariant,
fontSize = 14.sp
)
TextButton(
@@ -375,7 +381,7 @@ fun LoginScreen(
androidx.compose.ui.window.Dialog(onDismissRequest = { showRegisterDisabledDialog = false }) {
Surface(
shape = RoundedCornerShape(28.dp),
color = Color.White,
color = MaterialTheme.colorScheme.surface,
shadowElevation = 16.dp,
modifier = Modifier
.fillMaxWidth()
@@ -405,7 +411,7 @@ fun LoginScreen(
text = "注册已关闭",
fontWeight = FontWeight.Bold,
fontSize = 20.sp,
color = Slate900
color = MaterialTheme.colorScheme.onSurface
)
Spacer(modifier = Modifier.height(8.dp))
@@ -413,7 +419,7 @@ fun LoginScreen(
Text(
text = "系统目前禁止注册新用户",
fontSize = 15.sp,
color = Slate500,
color = MaterialTheme.colorScheme.onSurfaceVariant,
textAlign = TextAlign.Center
)