|
@@ -1,6 +1,7 @@
|
|
|
package com.example.triphelper.view.Registration
|
|
|
|
|
|
import androidx.compose.foundation.Image
|
|
|
+import androidx.compose.foundation.ScrollState
|
|
|
import androidx.compose.foundation.border
|
|
|
import androidx.compose.foundation.layout.Arrangement
|
|
|
import androidx.compose.foundation.layout.Box
|
|
@@ -11,10 +12,13 @@ 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.foundation.layout.size
|
|
|
import androidx.compose.foundation.layout.width
|
|
|
+import androidx.compose.foundation.layout.wrapContentSize
|
|
|
import androidx.compose.foundation.lazy.LazyColumn
|
|
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
|
|
import androidx.compose.material.icons.Icons
|
|
|
+import androidx.compose.material.icons.filled.ArrowForward
|
|
|
import androidx.compose.material.icons.filled.MoreVert
|
|
|
import androidx.compose.material3.Button
|
|
|
import androidx.compose.material3.ButtonDefaults.buttonColors
|
|
@@ -33,7 +37,6 @@ import androidx.compose.runtime.collectAsState
|
|
|
import androidx.compose.runtime.getValue
|
|
|
import androidx.compose.runtime.mutableStateOf
|
|
|
import androidx.compose.runtime.remember
|
|
|
-import androidx.compose.runtime.savedinstancestate.savedInstanceState
|
|
|
import androidx.compose.runtime.setValue
|
|
|
import androidx.compose.ui.Alignment
|
|
|
import androidx.compose.ui.Modifier
|
|
@@ -42,6 +45,8 @@ import androidx.compose.ui.graphics.Color
|
|
|
import androidx.compose.ui.res.painterResource
|
|
|
import androidx.compose.ui.text.font.FontFamily
|
|
|
import androidx.compose.ui.text.font.FontWeight
|
|
|
+import androidx.compose.ui.text.style.TextAlign
|
|
|
+import androidx.compose.ui.unit.DpOffset
|
|
|
import androidx.compose.ui.unit.dp
|
|
|
import androidx.compose.ui.unit.sp
|
|
|
import androidx.hilt.navigation.compose.hiltViewModel
|
|
@@ -54,6 +59,7 @@ import com.example.triphelper.view.style.TextFieldStylePasswordAuth
|
|
|
import com.example.triphelper.view.style.TripHelperLogoStyle
|
|
|
import com.example.triphelper.view.theme.Casagrand
|
|
|
import com.example.triphelper.view.theme.Roboto
|
|
|
+import com.example.triphelper.view.theme.SeoulLight
|
|
|
|
|
|
|
|
|
@Composable
|
|
@@ -67,6 +73,7 @@ fun Registration(
|
|
|
var selectedItem by remember { mutableStateOf("") }
|
|
|
val repeatPassword = remember { mutableStateOf("") }
|
|
|
val name = remember { mutableStateOf("") }
|
|
|
+ val coutryTitle = remember { mutableStateOf("") }
|
|
|
val country by viewModel.country.collectAsState(initial = emptyList())
|
|
|
|
|
|
LaunchedEffect(key1 = viewModel.navigationTo) {
|
|
@@ -102,14 +109,16 @@ fun Registration(
|
|
|
{
|
|
|
TextFieldStyleAuth("Почта", email)
|
|
|
TextFieldStyleAuth("Имя", name)
|
|
|
- var expanded by remember { mutableStateOf(false) }
|
|
|
- var selectedOption by remember { mutableStateOf("") }
|
|
|
Box {
|
|
|
- Button(onClick = { expanded = true
|
|
|
- viewModel.getCountry()},
|
|
|
+ Button(
|
|
|
+ onClick = {
|
|
|
+ expanded = true
|
|
|
+ viewModel.getCountry()
|
|
|
+ },
|
|
|
shape = RoundedCornerShape(15.dp),
|
|
|
modifier = Modifier
|
|
|
- .height(80.dp)
|
|
|
+ .fillMaxWidth()
|
|
|
+ .height(90.dp)
|
|
|
.border(
|
|
|
width = 4.dp,
|
|
|
color = Color(0xFF510B3C),
|
|
@@ -117,28 +126,80 @@ fun Registration(
|
|
|
),
|
|
|
colors = buttonColors(
|
|
|
containerColor = Color.White
|
|
|
- )) {
|
|
|
- Text("$selectedOption",
|
|
|
- fontFamily = Roboto,
|
|
|
- fontWeight = FontWeight.Bold,
|
|
|
- fontSize = 32.sp,
|
|
|
- color = Color(0xFFDC5B6E))
|
|
|
+ )
|
|
|
+ ) {
|
|
|
+ Row(
|
|
|
+ modifier = Modifier.fillMaxSize(), // Занимаем всю ширину кнопки
|
|
|
+ horizontalArrangement = Arrangement.Start, // Выравнивание по началу
|
|
|
+ verticalAlignment = Alignment.CenterVertically // Выравнивание по центру по вертикали
|
|
|
+ )
|
|
|
+ {
|
|
|
+ if (selectedItem.isEmpty()) {
|
|
|
+ Row(
|
|
|
+ horizontalArrangement = Arrangement.SpaceBetween,
|
|
|
+ verticalAlignment = Alignment.CenterVertically,
|
|
|
+ modifier = Modifier.fillMaxWidth()
|
|
|
+ )
|
|
|
+ {
|
|
|
+ Text(
|
|
|
+ "Выберите страну",
|
|
|
+ fontFamily = SeoulLight,
|
|
|
+ fontSize = 32.sp,
|
|
|
+ color = Color(0xFFDC5B6E).copy(alpha = 0.7f),
|
|
|
+ textAlign = TextAlign.Start
|
|
|
+ )
|
|
|
+ Icon(
|
|
|
+ painter = painterResource(id = R.drawable.galka_down),
|
|
|
+ contentDescription = null,
|
|
|
+ tint = Color(0xFFDC5B6E).copy(alpha = 0.7f),
|
|
|
+
|
|
|
+ )
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ Text(
|
|
|
+ "$selectedItem",
|
|
|
+ fontFamily = SeoulLight,
|
|
|
+ fontWeight = FontWeight.W600,
|
|
|
+ fontSize = 32.sp,
|
|
|
+ color = Color(0xFFDC5B6E),
|
|
|
+ textAlign = TextAlign.Start
|
|
|
+ )
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
}
|
|
|
DropdownMenu(
|
|
|
expanded = expanded,
|
|
|
- onDismissRequest = { expanded = false }
|
|
|
+ onDismissRequest = { expanded = false },
|
|
|
+ containerColor = Color.White,
|
|
|
+ modifier = Modifier
|
|
|
+ .fillMaxWidth(0.9f)
|
|
|
+ .height(200.dp)
|
|
|
) {
|
|
|
- country.forEach{
|
|
|
- item -> DropdownMenuItem(
|
|
|
- onClick = { selectedItem = item.title},
|
|
|
- text = { Text(item.title) })
|
|
|
+ country.forEach { item ->
|
|
|
+ DropdownMenuItem(
|
|
|
+ onClick = {
|
|
|
+ selectedItem = item.title
|
|
|
+ coutryTitle.value = item.title
|
|
|
+ expanded = false
|
|
|
+ },
|
|
|
+ text = {
|
|
|
+ Text(
|
|
|
+ text = item.title,
|
|
|
+ fontSize = 18.sp,
|
|
|
+ fontFamily = Roboto,
|
|
|
+ color = Color(0xFF510B3C),
|
|
|
+ fontWeight = FontWeight.Bold,
|
|
|
+ textAlign = TextAlign.Start
|
|
|
+ )
|
|
|
+ }
|
|
|
+ )
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ TextFieldStylePasswordAuth("Пароль", password)
|
|
|
+ TextFieldStylePasswordAuth("Повтор пароля", repeatPassword)
|
|
|
}
|
|
|
-
|
|
|
- TextFieldStylePasswordAuth("Пароль", password)
|
|
|
- TextFieldStylePasswordAuth("Повтор пароля", repeatPassword)
|
|
|
Row(
|
|
|
modifier = Modifier
|
|
|
|