|
@@ -5,12 +5,16 @@ import androidx.compose.material3.*
|
|
|
import androidx.compose.runtime.*
|
|
|
import androidx.compose.ui.Alignment
|
|
|
import androidx.compose.ui.Modifier
|
|
|
+import androidx.compose.ui.graphics.Color
|
|
|
+import androidx.compose.ui.text.TextStyle
|
|
|
import androidx.compose.ui.text.input.PasswordVisualTransformation
|
|
|
-import androidx.compose.ui.text.input.TextFieldValue
|
|
|
import androidx.compose.ui.unit.dp
|
|
|
+import androidx.compose.ui.unit.sp
|
|
|
+import androidx.compose.ui.text.font.FontWeight
|
|
|
import androidx.navigation.NavController
|
|
|
import com.example.fitmarcetplacekuzminiv.MainViewModel
|
|
|
-//Авторизация
|
|
|
+
|
|
|
+// Авторизация
|
|
|
@Composable
|
|
|
fun AuthScreen(navController: NavController, mainViewModel: MainViewModel) {
|
|
|
val email = remember { mutableStateOf("") }
|
|
@@ -29,7 +33,8 @@ fun AuthScreen(navController: NavController, mainViewModel: MainViewModel) {
|
|
|
}
|
|
|
|
|
|
Box(
|
|
|
- modifier = Modifier.fillMaxSize(),
|
|
|
+ modifier = Modifier
|
|
|
+ .fillMaxSize(),
|
|
|
contentAlignment = Alignment.Center
|
|
|
) {
|
|
|
Column(
|
|
@@ -39,25 +44,38 @@ fun AuthScreen(navController: NavController, mainViewModel: MainViewModel) {
|
|
|
.fillMaxWidth()
|
|
|
.padding(16.dp)
|
|
|
) {
|
|
|
+ // Добавляем заголовок "Авторизация"
|
|
|
+ Text(
|
|
|
+ text = "Авторизация",
|
|
|
+ style = TextStyle(fontSize = 28.sp, fontWeight = FontWeight.Bold),
|
|
|
+ color = Color.Black,
|
|
|
+ modifier = Modifier.padding(bottom = 16.dp)
|
|
|
+ )
|
|
|
+
|
|
|
OutlinedTextField(
|
|
|
value = email.value,
|
|
|
onValueChange = { newText -> email.value = newText },
|
|
|
- label = { Text("Email") },
|
|
|
+ label = { Text("Почта") },
|
|
|
modifier = Modifier.fillMaxWidth()
|
|
|
)
|
|
|
Spacer(modifier = Modifier.height(16.dp))
|
|
|
OutlinedTextField(
|
|
|
value = password.value,
|
|
|
onValueChange = { newText -> password.value = newText },
|
|
|
- label = { Text("Password") },
|
|
|
+ label = { Text("Пароль") },
|
|
|
visualTransformation = PasswordVisualTransformation(),
|
|
|
modifier = Modifier.fillMaxWidth()
|
|
|
)
|
|
|
Spacer(modifier = Modifier.height(24.dp))
|
|
|
- Button(onClick = {
|
|
|
- mainViewModel.onSignInEmailPassword(email.value, password.value)
|
|
|
- }) {
|
|
|
- Text("Login")
|
|
|
+ Button(
|
|
|
+ onClick = {
|
|
|
+ mainViewModel.onSignInEmailPassword(email.value, password.value)
|
|
|
+ },
|
|
|
+ colors = ButtonDefaults.buttonColors(
|
|
|
+ containerColor = Color(android.graphics.Color.parseColor("#32CD32")) // LimeGreen
|
|
|
+ )
|
|
|
+ ) {
|
|
|
+ Text("Войти")
|
|
|
}
|
|
|
|
|
|
// Отображаем сообщение об ошибке, если авторизация не удалась
|