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,26 +239,31 @@ fun Register_Screen(
Spacer(modifier = Modifier.height(20.dp)) Spacer(modifier = Modifier.height(20.dp))
//Reg_button if (uiState.isLoading) {
Button( CircularProgressIndicator() // 顯示載入圈圈
shape = RoundedCornerShape(8.dp), } else {
onClick = { //Reg_button
user_name_Error = if(user_name.isBlank()) "username is required" else "" Button(
emailError = if(email.isBlank()) "Email is required" else "" shape = RoundedCornerShape(8.dp),
passwordError = if(password.isBlank()) "password is required" else "" onClick = {
if (user_name_Error.isEmpty() && emailError.isEmpty() && passwordError.isEmpty()){ user_name_Error = if(username.isBlank()) "username is required" else ""
//login auth logic emailError = if(email.isBlank()) "Email is required" else ""
} passwordError = if(password.isBlank()) "password is required" else ""
}, //not empty do the auth
colors = ButtonDefaults.buttonColors( if (user_name_Error.isEmpty() && emailError.isEmpty() && passwordError.isEmpty()){
containerColor = main_orange, // 背景顏色 viewModel.handleRegister(displayName, email, password, username)
contentColor = Color.White // 文字顏色 }
) },
colors = ButtonDefaults.buttonColors(
) { containerColor = main_orange, // 背景顏色
Text( text = "Login") contentColor = Color.White // 文字顏色
)
) {
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(