Ajout icon visible password

pull/51/head
Leni BEAULATON 4 weeks ago
parent 311d876e1c
commit 1d9d3edc69

@ -0,0 +1,28 @@
package com.example.what_the_fantasy.ui.components
import androidx.compose.foundation.layout.size
import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.unit.dp
import com.example.what_the_fantasy.R
@Composable
fun VisibleIconPasswordComponent(passwordVisible : Boolean){
Icon(
painterResource(
if(passwordVisible){
R.drawable.password_visible
}
else{
R.drawable.password_no_visible
}
),
contentDescription = "visible",
modifier = Modifier
.size(20.dp),
tint = MaterialTheme.colorScheme.primary
)
}

@ -39,6 +39,7 @@ import com.example.what_the_fantasy.data.services.IServices
import com.example.what_the_fantasy.ui.components.ErrorMessageProfileComponent
import com.example.what_the_fantasy.ui.components.SpaceHeightComponent
import com.example.what_the_fantasy.ui.components.TitlePageComponent
import com.example.what_the_fantasy.ui.components.VisibleIconPasswordComponent
import com.example.what_the_fantasy.ui.components.hashPassword
import com.example.what_the_fantasy.ui.theme.colorBackground
import com.example.what_the_fantasy.ui.theme.gradienBox
@ -117,6 +118,7 @@ fun PassWdTextField(textpasswdResId : Int, password : String, onValueChange: (St
visualTransformation = if (passwordVisible) VisualTransformation.None else PasswordVisualTransformation(),
trailingIcon = {
IconButton(onClick = { passwordVisible = !passwordVisible }) {
VisibleIconPasswordComponent(passwordVisible)
}
},
shape = RoundedCornerShape(16.dp)

@ -53,6 +53,7 @@ import com.example.what_the_fantasy.ui.components.ErrorMessageProfileComponent
import com.example.what_the_fantasy.ui.components.NavBar
import com.example.what_the_fantasy.ui.components.SpaceHeightComponent
import com.example.what_the_fantasy.ui.components.TitlePageComponent
import com.example.what_the_fantasy.ui.components.VisibleIconPasswordComponent
import com.example.what_the_fantasy.ui.theme.gradienBox
@Composable
@ -315,6 +316,7 @@ fun EditPasswd(index: Int, service: IServices) {
confirmPassword = it
passwordError = newPassword != it // Vérifier si les mots de passe correspondent
},
passwordVisible = passwordVisible,
onPasswordVisibilityChange = { passwordVisible = it },
passwordError = passwordError,
@ -327,6 +329,7 @@ fun EditPasswd(index: Int, service: IServices) {
} else {
DisplayPassword(onEdit = { isEditingPassword = true }) // Afficher l'option pour modifier le mot de passe
}
}
@Composable
@ -400,7 +403,7 @@ fun PasswordTextField(
visualTransformation = if (passwordVisible) VisualTransformation.None else PasswordVisualTransformation(),
trailingIcon = {
IconButton(onClick = { onPasswordVisibilityChange(!passwordVisible) }) {
// Ajout d'une icône pour montrer/masquer le mot de passe
VisibleIconPasswordComponent(passwordVisible)
}
},
isError = isError

@ -1,6 +1,5 @@
package com.example.what_the_fantasy.ui.screens
import android.util.Log
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Box
@ -8,6 +7,7 @@ import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.text.KeyboardOptions
@ -18,6 +18,7 @@ import androidx.compose.material3.Button
import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.OutlinedTextField
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
@ -30,6 +31,7 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.input.KeyboardType
import androidx.compose.ui.text.input.PasswordVisualTransformation
@ -38,21 +40,17 @@ import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.lifecycle.viewmodel.compose.viewModel
import com.example.what_the_fantasy.R
import com.example.what_the_fantasy.data.model.Image
import com.example.what_the_fantasy.ui.components.SpaceHeightComponent
import com.example.what_the_fantasy.ui.components.TitlePageComponent
import com.example.what_the_fantasy.ui.theme.colorBackground
import com.example.what_the_fantasy.ui.theme.gradienBox
import com.example.what_the_fantasy.ui.components.ErrorMessageProfileComponent
import com.example.what_the_fantasy.ui.states.SignInUserState
import com.example.what_the_fantasy.ui.components.VisibleIconPasswordComponent
import com.example.what_the_fantasy.ui.viewModels.SignInUserViewModel
@Composable
fun SignUpPage(navControllerLogin: () -> Unit) {
var username by remember { mutableStateOf("") }
var email by remember { mutableStateOf("") }
var password by remember { mutableStateOf("") }
var confirmPassword by remember { mutableStateOf("") }
val signInUserVM : SignInUserViewModel = viewModel()
val signInState by signInUserVM.userState.collectAsState()
@ -156,7 +154,7 @@ fun PassWdTextFieldSign(textpasswdResId : Int, passwd: String, onValueChange: (S
IconButton(onClick = {
passwordVisible = !passwordVisible
}) {
Icon(imageVector = Icons.Default.Check, contentDescription = "Valider")
VisibleIconPasswordComponent(passwordVisible)
}
},
shape = RoundedCornerShape(16.dp)
@ -181,7 +179,7 @@ fun PassWdConfirmTextFieldSign(textpasswdResId : Int,confirmPassword: String, on
visualTransformation = if (passwordVisible) VisualTransformation.None else PasswordVisualTransformation(),
trailingIcon = {
IconButton(onClick = {passwordVisible = !passwordVisible}) {
Icon(imageVector = Icons.Default.Check, contentDescription = "Valider")
VisibleIconPasswordComponent(passwordVisible)
}
},
shape = RoundedCornerShape(16.dp)

@ -0,0 +1,18 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="96dp"
android:height="96dp"
android:viewportWidth="96"
android:viewportHeight="96">
<path
android:pathData="M45.6,45.8c-38,38.1 -40.4,41 -35.2,42 1.3,0.3 5,-2.8 12.1,-9.8l10.2,-10.2 4.3,2.8c3.7,2.5 5.4,2.9 11,2.9 5.5,-0 7.3,-0.4 10.7,-2.7 6.3,-4.1 8.8,-9 8.8,-16.9 0,-5.5 -0.4,-7.2 -2.9,-10.9l-2.8,-4.3 4.4,-4.3 4.3,-4.4 4.6,3.8c6.1,5 10.6,10.9 13.5,17.9 1.9,4.7 2.7,5.8 4.6,5.8 2,-0 2.3,-0.5 2.1,-3.3 -0.2,-5.8 -5.2,-14.3 -12.8,-21.8l-7.3,-7.2 6.5,-6.3c4.3,-4.3 6.3,-7.1 6.1,-8.4 -0.8,-5.5 -4,-2.9 -42.2,35.3zM60,47.2c7.6,12.4 -9,27.1 -20.1,17.9l-2.4,-2 2.6,-2.6c2.3,-2.3 2.8,-2.5 5.2,-1.4 5.4,2.5 10.5,-2.9 7.7,-8.1 -1,-1.8 -0.8,-2.6 1.1,-4.6 2.9,-3.1 3.5,-3 5.9,0.8z"
android:fillColor="#000000"
android:strokeColor="#00000000"/>
<path
android:pathData="M36,19.6c-9.3,2.5 -16.2,6.4 -23.1,13.3 -10.1,10.2 -15.8,24.1 -10.1,24.9 1.4,0.2 2.4,-0.3 2.8,-1.5 7.1,-21 25.4,-33.7 46,-31.9 6.6,0.5 7.3,0.4 9.3,-1.8l2.3,-2.4 -5.2,-1.1c-6.8,-1.5 -15.3,-1.3 -22,0.5z"
android:fillColor="#000000"
android:strokeColor="#00000000"/>
<path
android:pathData="M41.2,35.1c-6.6,1.9 -14.3,12.8 -13,18.4 0.2,0.7 4.9,-3.3 10.7,-9.1 10.8,-10.9 11,-11.8 2.3,-9.3z"
android:fillColor="#000000"
android:strokeColor="#00000000"/>
</vector>

@ -0,0 +1,14 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="96dp"
android:height="96dp"
android:viewportWidth="96"
android:viewportHeight="96">
<path
android:pathData="M36,19.6c-9.3,2.5 -16.2,6.4 -23.1,13.3 -10.1,10.2 -15.8,24.1 -10.1,24.9 1.4,0.2 2.4,-0.3 2.8,-1.5 2.4,-7.2 6.8,-14.6 11.2,-19 22.4,-22.4 59.9,-14.8 71.8,14.6 1.9,4.5 2.7,5.6 4.6,5.6 5.9,-0 -0.1,-14.5 -10.1,-24.5 -12.9,-12.7 -30.6,-17.8 -47.1,-13.4z"
android:fillColor="#000000"
android:strokeColor="#00000000"/>
<path
android:pathData="M40.5,35.9c-12.5,5.8 -15.5,20.7 -6.1,30.9 11.1,12.2 32.6,3.5 32.6,-13.2 0,-2.5 -0.5,-5.7 -1.1,-7.3 -2.4,-6.4 -10.9,-12.3 -17.9,-12.3 -1.9,-0 -5.3,0.9 -7.5,1.9zM53.5,41.4c10.4,4.4 9.8,20 -1,24.1 -4.5,1.8 -8.8,1.2 -12.5,-1.8 -7.5,-5.8 -6.2,-18.6 2.3,-22.2 4.1,-1.8 6.9,-1.8 11.2,-0.1z"
android:fillColor="#000000"
android:strokeColor="#00000000"/>
</vector>
Loading…
Cancel
Save