Иван пре 5 дана
родитељ
комит
3a4990168c

+ 18 - 5
Project/app/src/main/java/com/example/mygymapp/view/mainActivity/components/AuthScreen.kt

@@ -51,6 +51,8 @@ fun AuthScreen(navHost: NavHostController){
     val email = remember { mutableStateOf("")}
     val password = remember { mutableStateOf("")}
 
+    val passwordVisibility = remember { mutableStateOf(false) }
+
     Column(
         Modifier
             .background(color = BlueBlack)
@@ -112,20 +114,31 @@ fun AuthScreen(navHost: NavHostController){
             )
             TextField(
                 value = password.value,
-                onValueChange = {password.value = it},
-                visualTransformation = PasswordVisualTransformation(),
+                onValueChange = { password.value = it },
+                visualTransformation = if (passwordVisibility.value) VisualTransformation.None else PasswordVisualTransformation(),
                 textStyle = TextStyle(fontSize = 14.sp, color = BlueDark),
                 shape = RoundedCornerShape(5.dp),
                 modifier = Modifier
-                    .padding(top = 235.dp, start = 30.dp, end = 30.dp)
+                    .padding(top = 235.dp, start = 30.dp, end = if (passwordVisibility.value) 90.dp else 30.dp) // Рассчитать отступ для текстового поля в зависимости от видимости пароля
                     .height(50.dp),
                 placeholder = {
-                    Text("Введите пароль",
-                    style = TextStyle(fontSize = 14.sp))
+                    Text("Введите пароль", style = TextStyle(fontSize = 14.sp))
                 }
+            )
 
+            Image(
+                painter = painterResource(if (passwordVisibility.value) R.drawable.eyeoff else R.drawable.eye),
+                contentDescription = "Toggle Password Visibility",
+                modifier = Modifier
+                    .clickable { passwordVisibility.value = !passwordVisibility.value }
+                    .align(Alignment.CenterEnd)
+                    .padding(top = 100.dp)
+                    .size(48.dp)
             )
 
+
+
+
             Button(onClick = { viewModel.onSignInEmailPassword(email.value, password.value) },
                 colors = ButtonDefaults.buttonColors(Pearl),
                 modifier = Modifier

+ 2 - 2
Project/app/src/main/java/com/example/mygymapp/view/mainActivity/components/RegisterScreen.kt

@@ -131,9 +131,9 @@ fun RegisterScreen(navHost: NavHostController){
                 modifier = Modifier
                     .padding(top = 245.dp)
                     .align(alignment = Alignment.Center)
-                    .width(100.dp)
+                    .width(185.dp)
             ) {
-                Text("Войти")
+                Text("Зарегестрироваться")
             }
 
             Text(

BIN
Project/app/src/main/res/drawable/eye.png


BIN
Project/app/src/main/res/drawable/eyeoff.png