auth to server-V14

This commit is contained in:
Eric85710 2026-04-29 06:41:47 +08:00
parent 6b8c986ac7
commit 6dea851479
2 changed files with 27 additions and 19 deletions

View file

@ -20,6 +20,7 @@ import androidx.compose.material.icons.rounded.Visibility
import androidx.compose.material.icons.rounded.VisibilityOff import androidx.compose.material.icons.rounded.VisibilityOff
import androidx.compose.material3.Button import androidx.compose.material3.Button
import androidx.compose.material3.ButtonDefaults import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.CircularProgressIndicator
import androidx.compose.material3.Icon import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton import androidx.compose.material3.IconButton
import androidx.compose.material3.Text import androidx.compose.material3.Text
@ -238,25 +239,30 @@ fun Register_Screen(
Spacer(modifier = Modifier.height(20.dp)) Spacer(modifier = Modifier.height(20.dp))
if (uiState.isLoading) {
CircularProgressIndicator() // 顯示載入圈圈
} else {
//Reg_button //Reg_button
Button( Button(
shape = RoundedCornerShape(8.dp), shape = RoundedCornerShape(8.dp),
onClick = { onClick = {
user_name_Error = if(user_name.isBlank()) "username is required" else "" user_name_Error = if(username.isBlank()) "username is required" else ""
emailError = if(email.isBlank()) "Email is required" else "" emailError = if(email.isBlank()) "Email is required" else ""
passwordError = if(password.isBlank()) "password is required" else "" passwordError = if(password.isBlank()) "password is required" else ""
//not empty do the auth
if (user_name_Error.isEmpty() && emailError.isEmpty() && passwordError.isEmpty()){ if (user_name_Error.isEmpty() && emailError.isEmpty() && passwordError.isEmpty()){
//login auth logic viewModel.handleRegister(displayName, email, password, username)
} }
}, },
colors = ButtonDefaults.buttonColors( colors = ButtonDefaults.buttonColors(
containerColor = main_orange, // 背景顏色 containerColor = main_orange, // 背景顏色
contentColor = Color.White // 文字顏色 contentColor = Color.White // 文字顏色
) )
) { ) {
Text( text = "Login") Text( text = "Register")
} }
}
//input_block_end //input_block_end
} }

View file

@ -36,7 +36,9 @@ fun AppNavGraph(
BackHandler { BackHandler {
appViewModel.goTo(AppScreen.PreReg) appViewModel.goTo(AppScreen.PreReg)
} }
RegisterScreen() Register_Screen(
paddingValues = paddingValues
)
} }
AppScreen.Home -> HomeScreen( AppScreen.Home -> HomeScreen(