更新登录注册文案

将登录注册页面的部分文案替换为从资源文件中获取。
This commit is contained in:
2024-09-06 09:15:32 +08:00
parent 9cb847aa7c
commit b7da2981aa
6 changed files with 146 additions and 102 deletions

View File

@@ -196,13 +196,37 @@ fun NavigationController(
AccountProfile(it.arguments?.getString("id")!!) AccountProfile(it.arguments?.getString("id")!!)
} }
} }
composable(route = NavigationRoute.SignUp.route) { composable(
route = NavigationRoute.SignUp.route,
enterTransition = {
fadeIn(animationSpec = tween(durationMillis = 0))
},
exitTransition = {
fadeOut(animationSpec = tween(durationMillis = 0))
}
) {
SignupScreen() SignupScreen()
} }
composable(route = NavigationRoute.UserAuth.route) { composable(
route = NavigationRoute.UserAuth.route,
enterTransition = {
fadeIn(animationSpec = tween(durationMillis = 100))
},
exitTransition = {
fadeOut(animationSpec = tween(durationMillis = 100))
}
) {
UserAuthScreen() UserAuthScreen()
} }
composable(route = NavigationRoute.EmailSignUp.route) { composable(
route = NavigationRoute.EmailSignUp.route,
enterTransition = {
fadeIn(animationSpec = tween(durationMillis = 100))
},
exitTransition = {
fadeOut(animationSpec = tween(durationMillis = 100))
}
) {
EmailSignupScreen() EmailSignupScreen()
} }
composable(route = NavigationRoute.AccountEdit.route) { composable(route = NavigationRoute.AccountEdit.route) {
@@ -259,7 +283,10 @@ fun NavigationController(
@OptIn(ExperimentalSharedTransitionApi::class) @OptIn(ExperimentalSharedTransitionApi::class)
@Composable @Composable
fun Navigation(startDestination: String = NavigationRoute.Login.route,onLaunch: (navController: NavHostController) -> Unit) { fun Navigation(
startDestination: String = NavigationRoute.Login.route,
onLaunch: (navController: NavHostController) -> Unit
) {
val navController = rememberNavController() val navController = rememberNavController()
LaunchedEffect(Unit) { LaunchedEffect(Unit) {
onLaunch(navController) onLaunch(navController)

View File

@@ -18,6 +18,7 @@ import androidx.compose.runtime.LaunchedEffect
import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
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
@@ -76,7 +77,7 @@ fun LoginPage() {
modifier = Modifier modifier = Modifier
.width(162.dp) .width(162.dp)
.height(48.dp), .height(48.dp),
text = "Login in".uppercase(), text = stringResource(R.string.login_upper),
backgroundImage = R.mipmap.rider_pro_grey_bg_big backgroundImage = R.mipmap.rider_pro_grey_bg_big
) { ) {
navController.navigate( navController.navigate(
@@ -87,7 +88,7 @@ fun LoginPage() {
modifier = Modifier modifier = Modifier
.width(162.dp) .width(162.dp)
.height(48.dp), .height(48.dp),
text = "Sign In".uppercase(), text = stringResource(R.string.sign_in_upper),
backgroundImage = R.mipmap.rider_pro_red_bg_big backgroundImage = R.mipmap.rider_pro_red_bg_big
){ ){
navController.navigate( navController.navigate(

View File

@@ -24,6 +24,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
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
@@ -154,7 +155,7 @@ fun SignupScreen() {
modifier = Modifier modifier = Modifier
.width(345.dp) .width(345.dp)
.height(48.dp), .height(48.dp),
text = "CONTINUE WITH EMAIL".uppercase(), text = stringResource(R.string.sign_in_with_email),
backgroundImage = R.mipmap.rider_pro_signup_red_bg, backgroundImage = R.mipmap.rider_pro_signup_red_bg,
leading = { leading = {
Image( Image(
@@ -197,7 +198,7 @@ fun SignupScreen() {
) )
Spacer(modifier = Modifier.width(8.dp)) Spacer(modifier = Modifier.width(8.dp))
}, },
text = "CONTINUE WITH GOOGLE".uppercase(), text = stringResource(R.string.sign_in_with_google),
backgroundImage = R.mipmap.rider_pro_signup_white_bg backgroundImage = R.mipmap.rider_pro_signup_white_bg
) { ) {
googleLogin() googleLogin()
@@ -234,7 +235,7 @@ fun SignupScreen() {
) )
Spacer(modifier = Modifier.width(8.dp)) Spacer(modifier = Modifier.width(8.dp))
Text( Text(
"BACK", stringResource(R.string.back_upper),
color = Color.Black, color = Color.Black,
fontSize = 16.sp, fontSize = 16.sp,
fontWeight = FontWeight.Bold fontWeight = FontWeight.Bold

View File

@@ -2,6 +2,7 @@ package com.aiosman.riderpro.ui.login
import android.widget.Toast import android.widget.Toast
import androidx.compose.foundation.Image import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.border import androidx.compose.foundation.border
import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Column
@@ -45,6 +46,7 @@ import com.aiosman.riderpro.ui.NavigationRoute
import com.aiosman.riderpro.ui.comment.NoticeScreenHeader import com.aiosman.riderpro.ui.comment.NoticeScreenHeader
import com.aiosman.riderpro.ui.composables.ActionButton import com.aiosman.riderpro.ui.composables.ActionButton
import com.aiosman.riderpro.ui.composables.StatusBarMaskLayout import com.aiosman.riderpro.ui.composables.StatusBarMaskLayout
import com.aiosman.riderpro.ui.composables.StatusBarSpacer
import com.aiosman.riderpro.ui.composables.TextInputField import com.aiosman.riderpro.ui.composables.TextInputField
import com.aiosman.riderpro.ui.modifiers.noRippleClickable import com.aiosman.riderpro.ui.modifiers.noRippleClickable
import com.aiosman.riderpro.utils.GoogleLogin import com.aiosman.riderpro.utils.GoogleLogin
@@ -64,8 +66,10 @@ fun UserAuthScreen() {
var emailError by remember { mutableStateOf<String?>(null) } var emailError by remember { mutableStateOf<String?>(null) }
var passwordError by remember { mutableStateOf<String?>(null) } var passwordError by remember { mutableStateOf<String?>(null) }
fun validateForm(): Boolean { fun validateForm(): Boolean {
emailError = if (email.isEmpty()) context.getString(R.string.text_error_email_required) else null emailError =
passwordError = if (password.isEmpty()) context.getString(R.string.text_error_password_required) else null if (email.isEmpty()) context.getString(R.string.text_error_email_required) else null
passwordError =
if (password.isEmpty()) context.getString(R.string.text_error_password_required) else null
return emailError == null && passwordError == null return emailError == null && passwordError == null
} }
@@ -127,10 +131,13 @@ fun UserAuthScreen() {
} }
} }
StatusBarMaskLayout {
Column( Column(
horizontalAlignment = Alignment.CenterHorizontally, horizontalAlignment = Alignment.CenterHorizontally,
modifier = Modifier
.fillMaxSize()
.background(Color.White)
) { ) {
StatusBarSpacer()
Box( Box(
modifier = Modifier modifier = Modifier
.fillMaxWidth() .fillMaxWidth()
@@ -228,7 +235,7 @@ fun UserAuthScreen() {
} }
} }
}
} }

View File

@@ -29,4 +29,8 @@
<string name="text_error_password_required">密码是必填项</string> <string name="text_error_password_required">密码是必填项</string>
<string name="text_hint_email">输入邮箱</string> <string name="text_hint_email">输入邮箱</string>
<string name="text_hint_password">输入密码</string> <string name="text_hint_password">输入密码</string>
<string name="sign_in_upper">注册</string>
<string name="sign_in_with_email">使用邮箱注册</string>
<string name="sign_in_with_google">使用 Google 账号登录</string>
<string name="back_upper">返回</string>
</resources> </resources>

View File

@@ -28,4 +28,8 @@
<string name="text_error_password_required">Password is required</string> <string name="text_error_password_required">Password is required</string>
<string name="text_hint_email">Enter your email</string> <string name="text_hint_email">Enter your email</string>
<string name="text_hint_password">Enter your password</string> <string name="text_hint_password">Enter your password</string>
<string name="sign_in_upper">SIGN IN</string>
<string name="sign_in_with_email">CONTINUE WITH EMAIL</string>
<string name="sign_in_with_google">CONTINUE WITH GOOGLE</string>
<string name="back_upper">BACK</string>
</resources> </resources>