Bladeren bron

app: create users's profile

Bobarik41p 5 dagen geleden
bovenliggende
commit
506ac45bc3

+ 0 - 3
App/.idea/deploymentTargetSelector.xml

@@ -13,9 +13,6 @@
         </DropdownSelection>
         <DialogSelection />
       </SelectionState>
-      <SelectionState runConfigName="Profile">
-        <option name="selectionMode" value="DROPDOWN" />
-      </SelectionState>
     </selectionStates>
   </component>
 </project>

+ 329 - 0
App/.idea/other.xml

@@ -0,0 +1,329 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="direct_access_persist.xml">
+    <option name="deviceSelectionList">
+      <list>
+        <PersistentDeviceSelectionData>
+          <option name="api" value="27" />
+          <option name="brand" value="DOCOMO" />
+          <option name="codename" value="F01L" />
+          <option name="id" value="F01L" />
+          <option name="manufacturer" value="FUJITSU" />
+          <option name="name" value="F-01L" />
+          <option name="screenDensity" value="360" />
+          <option name="screenX" value="720" />
+          <option name="screenY" value="1280" />
+        </PersistentDeviceSelectionData>
+        <PersistentDeviceSelectionData>
+          <option name="api" value="28" />
+          <option name="brand" value="DOCOMO" />
+          <option name="codename" value="SH-01L" />
+          <option name="id" value="SH-01L" />
+          <option name="manufacturer" value="SHARP" />
+          <option name="name" value="AQUOS sense2 SH-01L" />
+          <option name="screenDensity" value="480" />
+          <option name="screenX" value="1080" />
+          <option name="screenY" value="2160" />
+        </PersistentDeviceSelectionData>
+        <PersistentDeviceSelectionData>
+          <option name="api" value="34" />
+          <option name="brand" value="Lenovo" />
+          <option name="codename" value="TB370FU" />
+          <option name="id" value="TB370FU" />
+          <option name="manufacturer" value="Lenovo" />
+          <option name="name" value="Tab P12" />
+          <option name="screenDensity" value="340" />
+          <option name="screenX" value="1840" />
+          <option name="screenY" value="2944" />
+        </PersistentDeviceSelectionData>
+        <PersistentDeviceSelectionData>
+          <option name="api" value="31" />
+          <option name="brand" value="samsung" />
+          <option name="codename" value="a51" />
+          <option name="id" value="a51" />
+          <option name="manufacturer" value="Samsung" />
+          <option name="name" value="Galaxy A51" />
+          <option name="screenDensity" value="420" />
+          <option name="screenX" value="1080" />
+          <option name="screenY" value="2400" />
+        </PersistentDeviceSelectionData>
+        <PersistentDeviceSelectionData>
+          <option name="api" value="34" />
+          <option name="brand" value="google" />
+          <option name="codename" value="akita" />
+          <option name="id" value="akita" />
+          <option name="manufacturer" value="Google" />
+          <option name="name" value="Pixel 8a" />
+          <option name="screenDensity" value="420" />
+          <option name="screenX" value="1080" />
+          <option name="screenY" value="2400" />
+        </PersistentDeviceSelectionData>
+        <PersistentDeviceSelectionData>
+          <option name="api" value="33" />
+          <option name="brand" value="samsung" />
+          <option name="codename" value="b0q" />
+          <option name="id" value="b0q" />
+          <option name="manufacturer" value="Samsung" />
+          <option name="name" value="Galaxy S22 Ultra" />
+          <option name="screenDensity" value="600" />
+          <option name="screenX" value="1440" />
+          <option name="screenY" value="3088" />
+        </PersistentDeviceSelectionData>
+        <PersistentDeviceSelectionData>
+          <option name="api" value="32" />
+          <option name="brand" value="google" />
+          <option name="codename" value="bluejay" />
+          <option name="id" value="bluejay" />
+          <option name="manufacturer" value="Google" />
+          <option name="name" value="Pixel 6a" />
+          <option name="screenDensity" value="420" />
+          <option name="screenX" value="1080" />
+          <option name="screenY" value="2400" />
+        </PersistentDeviceSelectionData>
+        <PersistentDeviceSelectionData>
+          <option name="api" value="34" />
+          <option name="brand" value="google" />
+          <option name="codename" value="caiman" />
+          <option name="id" value="caiman" />
+          <option name="manufacturer" value="Google" />
+          <option name="name" value="Pixel 9 Pro" />
+          <option name="screenDensity" value="360" />
+          <option name="screenX" value="960" />
+          <option name="screenY" value="2142" />
+        </PersistentDeviceSelectionData>
+        <PersistentDeviceSelectionData>
+          <option name="api" value="34" />
+          <option name="brand" value="google" />
+          <option name="codename" value="comet" />
+          <option name="id" value="comet" />
+          <option name="manufacturer" value="Google" />
+          <option name="name" value="Pixel 9 Pro Fold" />
+          <option name="screenDensity" value="390" />
+          <option name="screenX" value="2076" />
+          <option name="screenY" value="2152" />
+        </PersistentDeviceSelectionData>
+        <PersistentDeviceSelectionData>
+          <option name="api" value="29" />
+          <option name="brand" value="samsung" />
+          <option name="codename" value="crownqlteue" />
+          <option name="id" value="crownqlteue" />
+          <option name="manufacturer" value="Samsung" />
+          <option name="name" value="Galaxy Note9" />
+          <option name="screenDensity" value="420" />
+          <option name="screenX" value="2220" />
+          <option name="screenY" value="1080" />
+        </PersistentDeviceSelectionData>
+        <PersistentDeviceSelectionData>
+          <option name="api" value="34" />
+          <option name="brand" value="samsung" />
+          <option name="codename" value="dm3q" />
+          <option name="id" value="dm3q" />
+          <option name="manufacturer" value="Samsung" />
+          <option name="name" value="Galaxy S23 Ultra" />
+          <option name="screenDensity" value="600" />
+          <option name="screenX" value="1440" />
+          <option name="screenY" value="3088" />
+        </PersistentDeviceSelectionData>
+        <PersistentDeviceSelectionData>
+          <option name="api" value="34" />
+          <option name="brand" value="samsung" />
+          <option name="codename" value="e1q" />
+          <option name="id" value="e1q" />
+          <option name="manufacturer" value="Samsung" />
+          <option name="name" value="Galaxy S24" />
+          <option name="screenDensity" value="480" />
+          <option name="screenX" value="1080" />
+          <option name="screenY" value="2340" />
+        </PersistentDeviceSelectionData>
+        <PersistentDeviceSelectionData>
+          <option name="api" value="33" />
+          <option name="brand" value="google" />
+          <option name="codename" value="felix" />
+          <option name="id" value="felix" />
+          <option name="manufacturer" value="Google" />
+          <option name="name" value="Pixel Fold" />
+          <option name="screenDensity" value="420" />
+          <option name="screenX" value="2208" />
+          <option name="screenY" value="1840" />
+        </PersistentDeviceSelectionData>
+        <PersistentDeviceSelectionData>
+          <option name="api" value="34" />
+          <option name="brand" value="google" />
+          <option name="codename" value="felix" />
+          <option name="id" value="felix" />
+          <option name="manufacturer" value="Google" />
+          <option name="name" value="Pixel Fold" />
+          <option name="screenDensity" value="420" />
+          <option name="screenX" value="2208" />
+          <option name="screenY" value="1840" />
+        </PersistentDeviceSelectionData>
+        <PersistentDeviceSelectionData>
+          <option name="api" value="33" />
+          <option name="brand" value="google" />
+          <option name="codename" value="felix_camera" />
+          <option name="id" value="felix_camera" />
+          <option name="manufacturer" value="Google" />
+          <option name="name" value="Pixel Fold (Camera-enabled)" />
+          <option name="screenDensity" value="420" />
+          <option name="screenX" value="2208" />
+          <option name="screenY" value="1840" />
+        </PersistentDeviceSelectionData>
+        <PersistentDeviceSelectionData>
+          <option name="api" value="33" />
+          <option name="brand" value="samsung" />
+          <option name="codename" value="gts8uwifi" />
+          <option name="id" value="gts8uwifi" />
+          <option name="manufacturer" value="Samsung" />
+          <option name="name" value="Galaxy Tab S8 Ultra" />
+          <option name="screenDensity" value="320" />
+          <option name="screenX" value="1848" />
+          <option name="screenY" value="2960" />
+        </PersistentDeviceSelectionData>
+        <PersistentDeviceSelectionData>
+          <option name="api" value="34" />
+          <option name="brand" value="google" />
+          <option name="codename" value="husky" />
+          <option name="id" value="husky" />
+          <option name="manufacturer" value="Google" />
+          <option name="name" value="Pixel 8 Pro" />
+          <option name="screenDensity" value="390" />
+          <option name="screenX" value="1008" />
+          <option name="screenY" value="2244" />
+        </PersistentDeviceSelectionData>
+        <PersistentDeviceSelectionData>
+          <option name="api" value="30" />
+          <option name="brand" value="motorola" />
+          <option name="codename" value="java" />
+          <option name="id" value="java" />
+          <option name="manufacturer" value="Motorola" />
+          <option name="name" value="G20" />
+          <option name="screenDensity" value="280" />
+          <option name="screenX" value="720" />
+          <option name="screenY" value="1600" />
+        </PersistentDeviceSelectionData>
+        <PersistentDeviceSelectionData>
+          <option name="api" value="34" />
+          <option name="brand" value="google" />
+          <option name="codename" value="komodo" />
+          <option name="id" value="komodo" />
+          <option name="manufacturer" value="Google" />
+          <option name="name" value="Pixel 9 Pro XL" />
+          <option name="screenDensity" value="360" />
+          <option name="screenX" value="1008" />
+          <option name="screenY" value="2244" />
+        </PersistentDeviceSelectionData>
+        <PersistentDeviceSelectionData>
+          <option name="api" value="33" />
+          <option name="brand" value="google" />
+          <option name="codename" value="lynx" />
+          <option name="id" value="lynx" />
+          <option name="manufacturer" value="Google" />
+          <option name="name" value="Pixel 7a" />
+          <option name="screenDensity" value="420" />
+          <option name="screenX" value="1080" />
+          <option name="screenY" value="2400" />
+        </PersistentDeviceSelectionData>
+        <PersistentDeviceSelectionData>
+          <option name="api" value="31" />
+          <option name="brand" value="google" />
+          <option name="codename" value="oriole" />
+          <option name="id" value="oriole" />
+          <option name="manufacturer" value="Google" />
+          <option name="name" value="Pixel 6" />
+          <option name="screenDensity" value="420" />
+          <option name="screenX" value="1080" />
+          <option name="screenY" value="2400" />
+        </PersistentDeviceSelectionData>
+        <PersistentDeviceSelectionData>
+          <option name="api" value="33" />
+          <option name="brand" value="google" />
+          <option name="codename" value="panther" />
+          <option name="id" value="panther" />
+          <option name="manufacturer" value="Google" />
+          <option name="name" value="Pixel 7" />
+          <option name="screenDensity" value="420" />
+          <option name="screenX" value="1080" />
+          <option name="screenY" value="2400" />
+        </PersistentDeviceSelectionData>
+        <PersistentDeviceSelectionData>
+          <option name="api" value="34" />
+          <option name="brand" value="samsung" />
+          <option name="codename" value="q5q" />
+          <option name="id" value="q5q" />
+          <option name="manufacturer" value="Samsung" />
+          <option name="name" value="Galaxy Z Fold5" />
+          <option name="screenDensity" value="420" />
+          <option name="screenX" value="1812" />
+          <option name="screenY" value="2176" />
+        </PersistentDeviceSelectionData>
+        <PersistentDeviceSelectionData>
+          <option name="api" value="34" />
+          <option name="brand" value="samsung" />
+          <option name="codename" value="q6q" />
+          <option name="id" value="q6q" />
+          <option name="manufacturer" value="Samsung" />
+          <option name="name" value="Galaxy Z Fold6" />
+          <option name="screenDensity" value="420" />
+          <option name="screenX" value="1856" />
+          <option name="screenY" value="2160" />
+        </PersistentDeviceSelectionData>
+        <PersistentDeviceSelectionData>
+          <option name="api" value="30" />
+          <option name="brand" value="google" />
+          <option name="codename" value="r11" />
+          <option name="id" value="r11" />
+          <option name="manufacturer" value="Google" />
+          <option name="name" value="Pixel Watch" />
+          <option name="screenDensity" value="320" />
+          <option name="screenX" value="384" />
+          <option name="screenY" value="384" />
+          <option name="type" value="WEAR_OS" />
+        </PersistentDeviceSelectionData>
+        <PersistentDeviceSelectionData>
+          <option name="api" value="30" />
+          <option name="brand" value="google" />
+          <option name="codename" value="redfin" />
+          <option name="id" value="redfin" />
+          <option name="manufacturer" value="Google" />
+          <option name="name" value="Pixel 5" />
+          <option name="screenDensity" value="440" />
+          <option name="screenX" value="1080" />
+          <option name="screenY" value="2340" />
+        </PersistentDeviceSelectionData>
+        <PersistentDeviceSelectionData>
+          <option name="api" value="34" />
+          <option name="brand" value="google" />
+          <option name="codename" value="shiba" />
+          <option name="id" value="shiba" />
+          <option name="manufacturer" value="Google" />
+          <option name="name" value="Pixel 8" />
+          <option name="screenDensity" value="420" />
+          <option name="screenX" value="1080" />
+          <option name="screenY" value="2400" />
+        </PersistentDeviceSelectionData>
+        <PersistentDeviceSelectionData>
+          <option name="api" value="33" />
+          <option name="brand" value="google" />
+          <option name="codename" value="tangorpro" />
+          <option name="id" value="tangorpro" />
+          <option name="manufacturer" value="Google" />
+          <option name="name" value="Pixel Tablet" />
+          <option name="screenDensity" value="320" />
+          <option name="screenX" value="1600" />
+          <option name="screenY" value="2560" />
+        </PersistentDeviceSelectionData>
+        <PersistentDeviceSelectionData>
+          <option name="api" value="34" />
+          <option name="brand" value="google" />
+          <option name="codename" value="tokay" />
+          <option name="id" value="tokay" />
+          <option name="manufacturer" value="Google" />
+          <option name="name" value="Pixel 9" />
+          <option name="screenDensity" value="420" />
+          <option name="screenX" value="1080" />
+          <option name="screenY" value="2424" />
+        </PersistentDeviceSelectionData>
+      </list>
+    </option>
+  </component>
+</project>

+ 103 - 36
App/app/src/main/java/com/example/mystictale/Screen/Profile.kt

@@ -1,19 +1,26 @@
 package com.example.mystictale.Screen
 
+import androidx.compose.animation.AnimatedVisibility
 import androidx.compose.foundation.Image
+import androidx.compose.foundation.clickable
 import androidx.compose.foundation.gestures.detectTapGestures
 import androidx.compose.foundation.layout.Arrangement
 import androidx.compose.foundation.layout.Box
 import androidx.compose.foundation.layout.Column
+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.foundation.layout.width
+import androidx.compose.foundation.shape.RoundedCornerShape
+import androidx.compose.material3.Button
+import androidx.compose.material3.ButtonColors
+import androidx.compose.material3.Icon
 import androidx.compose.material3.Text
 import androidx.compose.runtime.Composable
 import androidx.compose.runtime.getValue
-import androidx.compose.runtime.mutableIntStateOf
 import androidx.compose.runtime.mutableStateOf
 import androidx.compose.runtime.remember
 import androidx.compose.ui.Alignment
@@ -32,15 +39,16 @@ import androidx.compose.ui.unit.sp
 import androidx.navigation.NavController
 import com.example.mystictale.R
 import com.example.mystictale.ViewModels.AuthViewModel
-import com.example.mystictale.models.Users
+import com.example.mystictale.resources.components.ChooseGenderForProfile
 import com.example.mystictale.resources.components.Loading
 import com.example.mystictale.resources.components.ProfileTextField
+import com.example.mystictale.ui.theme.DarkPurple
 import com.example.mystictale.ui.theme.Grey
 import com.example.mystictale.ui.theme.OpenSans
 
 @Composable
-fun Profile(navController: NavController) {
-    val viewModel = AuthViewModel()
+fun Profile(navController: NavController, viewModel: AuthViewModel) {
+
     val user by viewModel.user
     val focusManager = LocalFocusManager.current
     val keyboardController = LocalSoftwareKeyboardController.current
@@ -52,20 +60,19 @@ fun Profile(navController: NavController) {
         flag.value = false
     }
     if (user.isNotEmpty()) {
-        val name = remember {
-            mutableStateOf(user.last().name)
-        }
 
-        val date_of_birth = remember {
-            mutableStateOf(user.last().date_of_birth)
-        }
+
+        viewModel.name = user.last().name
+        viewModel.dateOfBirth = user.last().date_of_birth
+        viewModel.gender = user.last().id_gender
         val gender = remember {
-            mutableStateOf("")
-        }
-        if(user.last().id_gender == 1){
-            gender.value = "Женский"
-        }else{
-            gender.value = "Мужской"
+            mutableStateOf(
+                if (viewModel.gender == 1) {
+                    "Женский"
+                } else {
+                    "Мужской"
+                }
+            )
         }
         Column(
             Modifier
@@ -81,17 +88,50 @@ fun Profile(navController: NavController) {
                     })
                 }
                 .padding(10.dp)
-                .padding(top = 30.dp),
+                .padding(top = 40.dp),
             verticalArrangement = Arrangement.Top,
             horizontalAlignment = Alignment.CenterHorizontally
         ) {
-            Text(
-                text = "Профиль",
-                fontFamily = OpenSans,
-                fontWeight = FontWeight.Bold,
-                fontSize = 40.sp,
-                color = Color.White
-            )
+            Box(modifier = Modifier.fillMaxWidth()) {
+                Row(
+                    modifier = Modifier.fillMaxWidth(),
+                    horizontalArrangement = Arrangement.Center,
+                    verticalAlignment = Alignment.CenterVertically
+                ) {
+                    Text(
+                        text = "Профиль",
+                        fontFamily = OpenSans,
+                        fontWeight = FontWeight.Bold,
+                        fontSize = 40.sp,
+                        color = Color.White
+                    )
+                }
+                Row(
+                    modifier = Modifier.fillMaxWidth(),
+                    horizontalArrangement = Arrangement.End,
+                    verticalAlignment = Alignment.CenterVertically
+                ) {
+                    Icon(
+                        painter = painterResource(id = R.drawable.update),
+                        contentDescription = "update your profile",
+                        tint = Grey,
+                        modifier = Modifier
+                            .padding(end = 5.dp)
+                            .height(21.dp)
+                            .width(21.dp)
+                            .clickable {
+                                isEnabled.value = !isEnabled.value
+                                if (!isEnabled.value) {
+                                    if (viewModel.gender == 1) {
+                                        gender.value = "Женский"
+                                    } else {
+                                        gender.value = "Мужской"
+                                    }
+                                }
+                            }
+                    )
+                }
+            }
             Spacer(modifier = Modifier.height(20.dp))
             Image(painter = painterResource(id = R.drawable.girl), contentDescription = "")
             Spacer(modifier = Modifier.height(20.dp))
@@ -109,8 +149,8 @@ fun Profile(navController: NavController) {
                 )
                 Spacer(modifier = Modifier.height(10.dp))
                 ProfileTextField(
-                    value = name.value,
-                    onValue = { name.value = it }, placeholder = "Имя",
+                    value = viewModel.name!!,
+                    onValue = { viewModel.name = it }, placeholder = "Имя",
                     keyboardType = KeyboardType.Text,
                     isEnable = isEnabled.value,
                     flag = flagName.value
@@ -131,8 +171,8 @@ fun Profile(navController: NavController) {
                 )
                 Spacer(modifier = Modifier.height(10.dp))
                 ProfileTextField(
-                    value = date_of_birth.value,
-                    onValue = { date_of_birth.value = it },
+                    value = viewModel.dateOfBirth!!,
+                    onValue = { viewModel.dateOfBirth = it },
                     placeholder = "Дата рождения",
                     keyboardType = KeyboardType.Text,
                     isEnable = isEnabled.value,
@@ -153,15 +193,42 @@ fun Profile(navController: NavController) {
                     color = Grey
                 )
                 Spacer(modifier = Modifier.height(10.dp))
-                ProfileTextField(
-                    value = gender.value,
-                    onValue = { gender.value = it },
-                    placeholder = "Дата рождения",
-                    keyboardType = KeyboardType.Text,
-                    isEnable = isEnabled.value,
-                    flag = flagName.value
-                )
+                if (isEnabled.value) {
+                    ChooseGenderForProfile(viewModel = viewModel, gender = gender.value)
+                } else {
+                    ProfileTextField(
+                        value = gender.value,
+                        onValue = { gender.value = it },
+                        placeholder = "Дата рождения",
+                        keyboardType = KeyboardType.Text,
+                        isEnable = isEnabled.value,
+                        flag = flagName.value
+                    )
+                }
             }
+
+            AnimatedVisibility(visible = isEnabled.value, Modifier.padding(40.dp)) {
+                Button(
+                    onClick = {
+                    },
+                    modifier = Modifier
+                        .fillMaxWidth()
+                        .height(48.dp)
+                        .padding(horizontal = 30.dp),
+                    shape = RoundedCornerShape(12.dp),
+                    colors = ButtonColors(
+                        containerColor = DarkPurple,
+                        contentColor = Color.White,
+                        disabledContentColor = Color.White,
+                        disabledContainerColor = DarkPurple
+                    )
+                ) {
+                    Text("Далее", fontSize = 20.sp, fontWeight = FontWeight.Bold)
+
+                }
+            }
+
+
         }
     } else {
         Box(

+ 1 - 1
App/app/src/main/java/com/example/mystictale/navigation/Navigation.kt

@@ -64,7 +64,7 @@ fun Navigation() {
         }
         composable(Screens.Profile.route)
         {
-            Profile(navController)
+            Profile(navController,viewModel)
         }
 
     }

+ 102 - 0
App/app/src/main/java/com/example/mystictale/resources/components/ChooseGenderForProfile.kt

@@ -0,0 +1,102 @@
+package com.example.mystictale.resources.components
+
+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.fillMaxWidth
+import androidx.compose.foundation.layout.height
+import androidx.compose.foundation.layout.width
+import androidx.compose.foundation.shape.RoundedCornerShape
+import androidx.compose.material3.Button
+import androidx.compose.material3.ButtonDefaults
+import androidx.compose.material3.DropdownMenu
+import androidx.compose.material3.DropdownMenuItem
+import androidx.compose.material3.Text
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.remember
+import androidx.compose.runtime.setValue
+import androidx.compose.ui.Alignment
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.geometry.Size
+import androidx.compose.ui.graphics.Color
+import androidx.compose.ui.layout.onGloballyPositioned
+import androidx.compose.ui.platform.LocalDensity
+import androidx.compose.ui.text.font.FontWeight
+import androidx.compose.ui.text.style.TextAlign
+import androidx.compose.ui.unit.dp
+import androidx.compose.ui.unit.sp
+import androidx.compose.ui.unit.toSize
+import com.example.mystictale.ViewModels.AuthViewModel
+import com.example.mystictale.ui.theme.DarkPurple
+import com.example.mystictale.ui.theme.Grey
+import com.example.mystictale.ui.theme.OpenSans
+import com.example.mystictale.ui.theme.Purple
+
+@Composable
+fun ChooseGenderForProfile(viewModel: AuthViewModel, gender:String) {
+    var expanded by remember { mutableStateOf(false) }
+    val list = listOf("Мужской", "Женский")
+    var selectedItem by remember { mutableStateOf(gender) }
+    var buttonSize by remember { mutableStateOf(Size.Zero) }
+
+    Column(
+        modifier = Modifier
+            .fillMaxWidth(),
+        horizontalAlignment = Alignment.CenterHorizontally,
+        verticalArrangement = Arrangement.Center
+    ) {
+        Button(
+            onClick = { expanded = !expanded },
+            modifier = Modifier
+                .fillMaxWidth()
+                .height(52.dp)
+                .onGloballyPositioned { coordinates ->
+                    buttonSize = coordinates.size.toSize()
+                },
+            shape = RoundedCornerShape(12.dp),
+            colors = ButtonDefaults.buttonColors(
+                containerColor = Purple,
+                contentColor = Color.White
+            ),
+            contentPadding = PaddingValues(start = 16.dp, end = 16.dp)
+        ) {
+            Row(horizontalArrangement = Arrangement.Start, modifier = Modifier.fillMaxWidth()) {
+                Text(
+                    text = selectedItem.ifEmpty { "Выберите пол" },
+                    fontFamily = OpenSans,
+                    fontWeight = FontWeight.Normal,
+                    fontSize = 14.sp,
+                    textAlign = TextAlign.Start
+                )
+            }
+        }
+
+        DropdownMenu(
+            expanded = expanded,
+            onDismissRequest = { expanded = false },
+            modifier = Modifier
+                .width(with(LocalDensity.current) { buttonSize.width.toDp() })
+        ) {
+            list.forEach { label ->
+                DropdownMenuItem(
+                    text = {
+                        Text(
+                            text = label,
+                            fontSize = 15.sp,
+                            fontWeight = FontWeight.Normal
+                        )
+                    },
+                    onClick = {
+                        selectedItem = label
+                        expanded = false
+                        viewModel.gender = if (selectedItem == "Женский") 1 else 2
+
+                    }
+                )
+            }
+        }
+    }
+}

+ 4 - 3
App/app/src/main/java/com/example/mystictale/resources/components/ProfileTextField.kt

@@ -19,6 +19,7 @@ import androidx.compose.ui.unit.sp
 import com.example.mystictale.ui.theme.DarkPurple
 import com.example.mystictale.ui.theme.Grey
 import com.example.mystictale.ui.theme.OpenSans
+import com.example.mystictale.ui.theme.Purple
 
 @Composable
 fun ProfileTextField(
@@ -41,9 +42,9 @@ fun ProfileTextField(
         colors = TextFieldDefaults.colors(
             unfocusedTextColor = Color.White,
             unfocusedPlaceholderColor = Grey,
-            unfocusedContainerColor = DarkPurple,
+            unfocusedContainerColor = Purple,
             focusedTextColor = Color.White,
-            focusedContainerColor = DarkPurple,
+            focusedContainerColor = Purple,
             focusedPlaceholderColor = Color.White,
             focusedIndicatorColor = Color.Transparent,
             unfocusedIndicatorColor = Color.Transparent,
@@ -52,7 +53,7 @@ fun ProfileTextField(
             errorPlaceholderColor = Color.White,
             disabledTextColor = Color.White,
             disabledContainerColor = DarkPurple,
-            disabledPlaceholderColor = Color.White
+            disabledPlaceholderColor = Color.White,
         ),
         isError = flag,
 

+ 1 - 0
App/app/src/main/java/com/example/mystictale/ui/theme/Color.kt

@@ -11,4 +11,5 @@ val PurpleGrey40 = Color(0xFF625b71)
 val Pink40 = Color(0xFF7D5260)
 val DarkPurple = Color(0xFF28176B)
 val Grey = Color(0xFFA1A0A3)
+val Purple = Color(0xFF493795)
 

BIN
App/app/src/main/res/drawable/update.png