Skip to content

Commit

Permalink
Add documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Puvikaran2001 committed May 22, 2024
1 parent d85ae75 commit aa4ac72
Showing 1 changed file with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,37 +49,37 @@ fun LoginPage(
val coroutineScope = rememberCoroutineScope()

Title(titleText = "Login")

// Arranges the fields and the button in vertical sequence.
Column(
modifier =
modifier
.fillMaxSize()
.padding(50.dp),
.padding(50.dp), // Adjust column placement.
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.Center,
) {
StandardTextField(
StandardTextField( // Input field for username.
label = "Username",
value = username,
onValueChange = {
username = it
username = it // it holds the value of the text field.
if (isLoginFailed) isLoginFailed = false
},
isError = isLoginFailed,
)

Spacer(modifier = Modifier.height(20.dp))

PasswordTextField(
PasswordTextField( // Input field for password.
password,
onPasswordChange = {
password = it
password = it // it holds the value of the text field.
if (isLoginFailed) isLoginFailed = false
},
isError = isLoginFailed,
)

if (isLoginFailed) {
if (isLoginFailed) { // Shows an error message if the login fails
Spacer(modifier = Modifier.height(20.dp))
Text(
text = "Wrong username or password",
Expand All @@ -91,7 +91,7 @@ fun LoginPage(

FilledButton(
onClick = {
coroutineScope.launch {
coroutineScope.launch { // Runs asynchronous
if (accountRepo.login(username, password)) {
navigateOnValidLogin()
} else {
Expand Down

0 comments on commit aa4ac72

Please sign in to comment.