Merge pull request #72 from Kevinlinpr/zhong_1

首页、登录、找回密码、注册界面UI调整
This commit is contained in:
2025-11-12 18:11:19 +08:00
committed by GitHub
19 changed files with 75 additions and 32 deletions

Binary file not shown.

View File

@@ -20,12 +20,14 @@ import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.runtime.setValue import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.TextStyle import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp import androidx.compose.ui.unit.sp
import com.aiosman.ravenow.AppState
import com.aiosman.ravenow.ConstVars import com.aiosman.ravenow.ConstVars
import com.aiosman.ravenow.data.api.ErrorCode import com.aiosman.ravenow.data.api.ErrorCode
import com.aiosman.ravenow.LocalAppTheme import com.aiosman.ravenow.LocalAppTheme
@@ -99,10 +101,11 @@ fun ResetPasswordScreen() {
if (e.code == ErrorCode.USER_NOT_EXIST.code){ if (e.code == ErrorCode.USER_NOT_EXIST.code){
usernameError = context.getString(R.string.error_40002_user_not_exist) usernameError = context.getString(R.string.error_40002_user_not_exist)
} else { } else {
Toast.makeText(context, e.message, Toast.LENGTH_SHORT).show() // 其他错误不显示Toast
isSendSuccess = false
} }
} catch (e: Exception) { } catch (e: Exception) {
Toast.makeText(context, e.message, Toast.LENGTH_SHORT).show() // 异常错误不显示Toast
isSendSuccess = false isSendSuccess = false
} finally { } finally {
isLoading = false isLoading = false
@@ -133,12 +136,21 @@ fun ResetPasswordScreen() {
modifier = Modifier.padding(horizontal = 24.dp), modifier = Modifier.padding(horizontal = 24.dp),
horizontalAlignment = Alignment.CenterHorizontally horizontalAlignment = Alignment.CenterHorizontally
) { ) {
// 暗色模式下的 hint 文本颜色
val isDarkMode = AppState.darkMode
val hintColor = if (isDarkMode) {
Color(0xFFFFFFFF).copy(alpha = 0.7f)
} else {
null // 使用默认颜色
}
TextInputField( TextInputField(
text = username, text = username,
onValueChange = { username = it }, onValueChange = { username = it },
hint = stringResource(R.string.text_hint_email), hint = stringResource(R.string.text_hint_email),
enabled = !isLoading && countDown == null, enabled = !isLoading && countDown == null,
error = usernameError, error = usernameError,
customHintColor = hintColor
) )
Spacer(modifier = Modifier.height(16.dp)) Spacer(modifier = Modifier.height(16.dp))
Box( Box(
@@ -178,9 +190,11 @@ fun ResetPasswordScreen() {
} else { } else {
stringResource(R.string.recover) stringResource(R.string.recover)
}, },
backgroundColor = appColors.main, backgroundColor = Color(0xFF7C45ED), // 紫色背景
loadingBackgroundColor = Color(0xFF7C45ED), // loading 时保持紫色
disabledBackgroundColor = Color(0xFF7C45ED), // disabled 时保持紫色
color = appColors.mainText, color = appColors.mainText,
isLoading = isLoading, isLoading = isLoading && countDown == null, // 只在未发送成功时显示loading
contentPadding = PaddingValues(0.dp), contentPadding = PaddingValues(0.dp),
enabled = countDown == null, enabled = countDown == null,
) { ) {
@@ -193,6 +207,8 @@ fun ResetPasswordScreen() {
.fillMaxWidth() .fillMaxWidth()
.height(48.dp), .height(48.dp),
text = stringResource(R.string.back_upper), text = stringResource(R.string.back_upper),
backgroundColor = Color(0xFF7C45ED), // 紫色背景
color = Color.White, // 白色文字
contentPadding = PaddingValues(0.dp), contentPadding = PaddingValues(0.dp),
) { ) {
navController.navigateUp() navController.navigateUp()

View File

@@ -97,7 +97,7 @@ fun PolicyCheckbox(
addStyle( addStyle(
style = SpanStyle( style = SpanStyle(
color = appColor.main, color = Color(0xFF7C45ED), // 紫色
textDecoration = TextDecoration.Underline textDecoration = TextDecoration.Underline
), ),
start = template.length + 1, start = template.length + 1,

View File

@@ -182,6 +182,7 @@ fun Agent() {
colors = TopAppBarDefaults.topAppBarColors( colors = TopAppBarDefaults.topAppBarColors(
containerColor = AppColors.background containerColor = AppColors.background
), ),
windowInsets = WindowInsets(0, 0, 0, 0),
modifier = Modifier modifier = Modifier
.height(44.dp + statusBarPaddingValues.calculateTopPadding()) .height(44.dp + statusBarPaddingValues.calculateTopPadding())
.padding(top = statusBarPaddingValues.calculateTopPadding()) .padding(top = statusBarPaddingValues.calculateTopPadding())

View File

@@ -160,6 +160,13 @@ fun EmailSignupScreen() {
) { ) {
StatusBarSpacer() StatusBarSpacer()
// 顶部导航栏:返回箭头 + "注册"标题,左对齐 // 顶部导航栏:返回箭头 + "注册"标题,左对齐
// 根据暗色模式适配颜色
val isDarkMode = AppState.darkMode
val textColor = if (isDarkMode) {
Color.White
} else {
Color.Black
}
Row( Row(
modifier = Modifier modifier = Modifier
.fillMaxWidth() .fillMaxWidth()
@@ -174,14 +181,14 @@ fun EmailSignupScreen() {
.noRippleClickable { .noRippleClickable {
navController.navigateUp() navController.navigateUp()
}, },
colorFilter = ColorFilter.tint(Color.Black) colorFilter = ColorFilter.tint(textColor)
) )
Spacer(modifier = Modifier.width(8.dp)) Spacer(modifier = Modifier.width(8.dp))
Text( Text(
text = stringResource(R.string.sign_up_upper), text = stringResource(R.string.sign_up_upper),
fontSize = 20.sp, fontSize = 20.sp,
fontWeight = FontWeight.W600, fontWeight = FontWeight.W600,
color = Color.Black color = textColor
) )
} }
@@ -194,6 +201,19 @@ fun EmailSignupScreen() {
) { ) {
Spacer(modifier = Modifier.height(16.dp)) Spacer(modifier = Modifier.height(16.dp))
// 暗色模式下的输入框颜色配置
val isDarkMode = AppState.darkMode
val inputBackgroundColor = if (isDarkMode) {
Color(0xFF1C1C1C) // 暗色模式下深灰色背景
} else {
null // 亮色模式下使用默认背景
}
val textColor = if (isDarkMode) {
Color(0xFFFFFFFF).copy(alpha = 0.7f) // 暗色模式下 label 和 hint 文本颜色
} else {
null // 使用默认颜色
}
// 邮箱输入框 // 邮箱输入框
TextInputField( TextInputField(
modifier = Modifier modifier = Modifier
@@ -214,7 +234,9 @@ fun EmailSignupScreen() {
colorFilter = ColorFilter.tint(IconGray) colorFilter = ColorFilter.tint(IconGray)
) )
}, },
customBackgroundColor = LightGrayBackground, customBackgroundColor = inputBackgroundColor,
customHintColor = textColor,
customLabelColor = textColor,
customCornerRadius = 16f customCornerRadius = 16f
) )
@@ -239,7 +261,9 @@ fun EmailSignupScreen() {
colorFilter = ColorFilter.tint(IconGray) colorFilter = ColorFilter.tint(IconGray)
) )
}, },
customBackgroundColor = LightGrayBackground, customBackgroundColor = inputBackgroundColor,
customHintColor = textColor,
customLabelColor = textColor,
customCornerRadius = 16f customCornerRadius = 16f
) )
@@ -264,7 +288,9 @@ fun EmailSignupScreen() {
colorFilter = ColorFilter.tint(IconGray) colorFilter = ColorFilter.tint(IconGray)
) )
}, },
customBackgroundColor = LightGrayBackground, customBackgroundColor = inputBackgroundColor,
customHintColor = textColor,
customLabelColor = textColor,
customCornerRadius = 16f customCornerRadius = 16f
) )

View File

@@ -280,10 +280,7 @@ fun LoginPage() {
Box( Box(
modifier = Modifier modifier = Modifier
.size(30.dp) .size(30.dp)
.background(
color = AppColors.text.copy(alpha = 0.1f),
shape = androidx.compose.foundation.shape.CircleShape
)
.noRippleClickable { .noRippleClickable {
guestLogin() guestLogin()
}, },
@@ -292,7 +289,7 @@ fun LoginPage() {
Image( Image(
painter = painterResource(id = R.drawable.rider_pro_close), painter = painterResource(id = R.drawable.rider_pro_close),
contentDescription = "Close", contentDescription = "Close",
modifier = Modifier.size(16.dp), modifier = Modifier.size(24.dp),
colorFilter = ColorFilter.tint(AppColors.text) colorFilter = ColorFilter.tint(AppColors.text)
) )
} }
@@ -313,26 +310,26 @@ fun LoginPage() {
.height(400.dp) .height(400.dp)
) { ) {
val lottieFile = if (AppState.darkMode) "login.lottie" else "login_light.lottie" val lottieFile = "login.lottie"
LottieAnimation( LottieAnimation(
composition = rememberLottieComposition(LottieCompositionSpec.Asset(lottieFile)).value, composition = rememberLottieComposition(LottieCompositionSpec.Asset(lottieFile)).value,
iterations = LottieConstants.IterateForever, iterations = LottieConstants.IterateForever,
modifier = Modifier.fillMaxSize() modifier = Modifier.fillMaxSize()
) )
} }
Image(
painter = painterResource(if(AppState.darkMode) R.mipmap.login_paipia_dark else R.mipmap.login_paipia_light),
contentDescription = "",
modifier = Modifier
.size(width = 140.dp, height = 30.dp)
)
Spacer(modifier = Modifier.height(10.dp))
Text( Text(
text = stringResource(R.string.join_party_carnival), text = stringResource(R.string.join_party_carnival),
fontSize = 17.sp, fontSize = 17.sp,
color = AppColors.text.copy(alpha = 0.6f),
fontWeight = FontWeight.W600, fontWeight = FontWeight.W600,
color = AppColors.text
) )
// Image(
// painter = painterResource(id = R.mipmap.invalid_name),
// contentDescription = "Rave Now",
// modifier = Modifier
// .size(52.dp)
// .clip(RoundedCornerShape(10.dp))
// )
// Spacer(modifier = Modifier.height(8.dp)) // Spacer(modifier = Modifier.height(8.dp))
// Text( // Text(
// "Rave Now", // "Rave Now",
@@ -347,16 +344,16 @@ fun LoginPage() {
// fontWeight = FontWeight.W700, // fontWeight = FontWeight.W700,
// color = AppColors.text // color = AppColors.text
// ) // )
//注册tab //登录tab
Spacer(modifier = Modifier.height(48.dp)) Spacer(modifier = Modifier.height(35.dp))
ActionButton( ActionButton(
modifier = Modifier.fillMaxWidth(), modifier = Modifier.fillMaxWidth(),
text = stringResource(R.string.sign_up_upper), text = stringResource(R.string.login_upper),
color = if (AppState.darkMode) Color.Black else Color.White, color = if (AppState.darkMode) Color.Black else Color.White,
backgroundColor = if (AppState.darkMode) Color.White else Color.Black backgroundColor = if (AppState.darkMode) Color.White else Color.Black
) { ) {
navController.navigate( navController.navigate(
NavigationRoute.EmailSignUp.route, NavigationRoute.UserAuth.route,
) )
} }
//谷歌登录tab //谷歌登录tab
@@ -386,10 +383,10 @@ fun LoginPage() {
googleLogin() googleLogin()
} }
//登录tab //注册tab
Spacer(modifier = Modifier.height(24.dp)) Spacer(modifier = Modifier.height(24.dp))
Text( Text(
text = stringResource(R.string.login_upper), text = stringResource(R.string.sign_up_upper),
color = AppColors.text.copy(alpha = 0.5f), color = AppColors.text.copy(alpha = 0.5f),
fontSize = 16.sp, fontSize = 16.sp,
textAlign = TextAlign.Center, textAlign = TextAlign.Center,
@@ -397,7 +394,7 @@ fun LoginPage() {
.fillMaxWidth() .fillMaxWidth()
.noRippleClickable { .noRippleClickable {
navController.navigate( navController.navigate(
NavigationRoute.UserAuth.route, NavigationRoute.EmailSignUp.route,
) )
} }
) )

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

View File

@@ -367,5 +367,6 @@
<string name="why_not_start_with_agent">エージェントから世界を知り始めませんか?</string> <string name="why_not_start_with_agent">エージェントから世界を知り始めませんか?</string>
<string name="explore">探検する</string> <string name="explore">探検する</string>
<string name="reply_to_user">返信@%1$s</string> <string name="reply_to_user">返信@%1$s</string>
<string name="error_select_at_least_one_image">少なくとも1枚の画像を選択してください。</string>
</resources> </resources>

View File

@@ -380,4 +380,5 @@
<string name="why_not_start_with_agent">不如从一个 Agent 开始认识这世界?</string> <string name="why_not_start_with_agent">不如从一个 Agent 开始认识这世界?</string>
<string name="explore">去探索</string> <string name="explore">去探索</string>
<string name="reply_to_user">回复@%1$s</string> <string name="reply_to_user">回复@%1$s</string>
<string name="error_select_at_least_one_image">请至少选择一张图片</string>
</resources> </resources>

View File

@@ -373,4 +373,5 @@
<string name="why_not_start_with_agent">Why not start exploring the world with an Agent?</string> <string name="why_not_start_with_agent">Why not start exploring the world with an Agent?</string>
<string name="explore">Explore</string> <string name="explore">Explore</string>
<string name="reply_to_user">Reply @%1$s</string> <string name="reply_to_user">Reply @%1$s</string>
<string name="error_select_at_least_one_image">Please select at least one image</string>
</resources> </resources>