-
Notifications
You must be signed in to change notification settings - Fork 453
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New UI to change password #1781
base: dev
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -111,12 +111,18 @@ fun MfPasswordTextField( | |
onPasswordChange: (String) -> Unit, | ||
modifier: Modifier = Modifier, | ||
errorMessage: String? = null, | ||
|
||
) { | ||
|
||
OutlinedTextField( | ||
modifier = modifier, | ||
value = password, | ||
onValueChange = onPasswordChange, | ||
label = { Text(label) }, | ||
label = { Text( | ||
label, | ||
color = NewUi.primaryColor, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you format these lines of code. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I already change |
||
style = MaterialTheme.typography.labelLarge | ||
) }, | ||
isError = isError, | ||
visualTransformation = | ||
if (isPasswordVisible) { | ||
|
@@ -132,9 +138,16 @@ fun MfPasswordTextField( | |
Icon( | ||
if (isPasswordVisible) Icons.Filled.Visibility else Icons.Filled.VisibilityOff, | ||
contentDescription = "Show password", | ||
tint = Color.Black, | ||
) | ||
} | ||
}, | ||
colors = OutlinedTextFieldDefaults.colors( | ||
focusedBorderColor = Color.Transparent, // Cor da borda quando focado | ||
unfocusedBorderColor = Color.Transparent, // Cor da borda quando não focado | ||
errorBorderColor = Color.Transparent, // Cor da borda quando em erro | ||
disabledBorderColor = Color.Transparent, // Cor da borda quando desabilitado | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And remove these comments too There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
) | ||
) | ||
} | ||
|
||
|
@@ -301,8 +314,12 @@ fun MfOutlinedTextFieldPreview() { | |
fun MfPasswordTextFieldPreview() { | ||
MifosTheme { | ||
val password = " " | ||
|
||
Box( | ||
|
||
modifier = Modifier.background(color = Color.White), | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove these extra blank lines.. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
|
||
) { | ||
MfPasswordTextField( | ||
password = password, | ||
|
@@ -313,6 +330,7 @@ fun MfPasswordTextFieldPreview() { | |
onPasswordChange = { }, | ||
modifier = Modifier.fillMaxWidth(), | ||
errorMessage = "Password must be at least 6 characters", | ||
|
||
) | ||
} | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,11 +9,14 @@ | |
*/ | ||
package org.mifospay.feature.editpassword | ||
|
||
import androidx.compose.foundation.layout.Arrangement | ||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.PaddingValues | ||
import androidx.compose.foundation.layout.Row | ||
import androidx.compose.foundation.layout.Spacer | ||
import androidx.compose.foundation.layout.fillMaxSize | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.height | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.material3.SnackbarHost | ||
import androidx.compose.material3.SnackbarHostState | ||
|
@@ -41,7 +44,10 @@ import org.koin.androidx.compose.koinViewModel | |
import org.mifospay.core.designsystem.component.MfPasswordTextField | ||
import org.mifospay.core.designsystem.component.MifosButton | ||
import org.mifospay.core.designsystem.component.MifosScaffold | ||
import org.mifospay.core.designsystem.theme.MifosBlue | ||
import org.mifospay.core.designsystem.theme.MifosTheme | ||
import org.mifospay.core.designsystem.theme.NewUi.gradientOne | ||
|
||
|
||
@Composable | ||
internal fun EditPasswordScreen( | ||
|
@@ -119,6 +125,8 @@ private fun EditPasswordScreen( | |
modifier = Modifier | ||
.fillMaxSize() | ||
.padding(paddingValues), | ||
horizontalAlignment = Alignment.CenterHorizontally, | ||
verticalArrangement = Arrangement.Center | ||
) { | ||
MfPasswordTextField( | ||
password = currentPassword, | ||
|
@@ -130,9 +138,10 @@ private fun EditPasswordScreen( | |
}, | ||
onPasswordChange = { currentPassword = it }, | ||
modifier = Modifier | ||
.fillMaxWidth() | ||
.padding(horizontal = 16.dp), | ||
) | ||
.fillMaxWidth(0.9f) | ||
.padding(vertical = 8.dp), | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove the blank lines There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
) | ||
MfPasswordTextField( | ||
password = newPassword, | ||
|
||
|
@@ -142,8 +151,8 @@ private fun EditPasswordScreen( | |
onTogglePasswordVisibility = { isNewPasswordVisible = !isNewPasswordVisible }, | ||
onPasswordChange = { newPassword = it }, | ||
modifier = Modifier | ||
.fillMaxWidth() | ||
.padding(horizontal = 16.dp), | ||
.fillMaxWidth(0.9f) | ||
.padding(vertical = 8.dp), | ||
errorMessage = if (newPassword.isNotEmpty() && newPassword.length < 6) { | ||
stringResource( | ||
id = R.string.feature_editpassword_password_length_error, | ||
|
@@ -162,8 +171,9 @@ private fun EditPasswordScreen( | |
}, | ||
onPasswordChange = { confirmNewPassword = it }, | ||
modifier = Modifier | ||
.fillMaxWidth() | ||
.padding(horizontal = 16.dp), | ||
.fillMaxWidth(0.9f) | ||
.padding(vertical = 8.dp), | ||
|
||
errorMessage = if (newPassword != | ||
confirmNewPassword && confirmNewPassword.isNotEmpty() | ||
) { | ||
|
@@ -175,29 +185,47 @@ private fun EditPasswordScreen( | |
}, | ||
) | ||
|
||
Row( | ||
Column( | ||
modifier = Modifier | ||
.fillMaxWidth() | ||
.padding(top = 20.dp, start = 16.dp, end = 16.dp), | ||
verticalAlignment = Alignment.CenterVertically, | ||
horizontalAlignment = Alignment.CenterHorizontally, // Alinha os botões ao centro | ||
) { | ||
Spacer(modifier = Modifier.weight(1f)) | ||
|
||
MifosButton( | ||
onClick = { onCancelChanges.invoke() }, | ||
modifier = Modifier | ||
.weight(1f) | ||
.padding(8.dp), | ||
.fillMaxWidth() | ||
.padding(horizontal = 20.dp) | ||
.height(54.dp), | ||
color = MifosBlue, // Cor do botão de "Salvar" | ||
onClick = { | ||
onSave.invoke(currentPassword, newPassword, confirmNewPassword) | ||
}, | ||
contentPadding = PaddingValues(16.dp), | ||
content = { Text(text = stringResource(id = R.string.feature_editpassword_cancel)) }, | ||
content = { Text(text = stringResource(id = R.string.feature_editpassword_save)) }, | ||
) | ||
Spacer(modifier = Modifier.height(8.dp)) | ||
|
||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove here too |
||
|
||
MifosButton( | ||
modifier = Modifier | ||
.weight(1f) | ||
.padding(8.dp), | ||
.fillMaxWidth() | ||
.padding(horizontal = 20.dp) | ||
.height(54.dp), | ||
color = gradientOne, | ||
|
||
onClick = { | ||
onSave.invoke(currentPassword, newPassword, confirmNewPassword) | ||
onCancelChanges.invoke() | ||
}, | ||
contentPadding = PaddingValues(16.dp), | ||
content = { Text(text = stringResource(id = R.string.feature_editpassword_save)) }, | ||
content = { | ||
Text( | ||
text = stringResource(id = R.string.feature_editpassword_cancel), | ||
color = MifosBlue, | ||
) | ||
}, | ||
) | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you remove blank lines
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done