Browse Source

frontend: Профиль пользователя

ZryachevTA 2 weeks ago
parent
commit
76ecb962e2

+ 7 - 1
Frontend/app/src/main/java/com/example/neurea/views/MainActivity.kt

@@ -12,17 +12,23 @@ import androidx.compose.material3.Scaffold
 import androidx.compose.material3.Surface
 import androidx.compose.material3.Text
 import androidx.compose.runtime.Composable
+import androidx.compose.runtime.MutableState
+import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.remember
 import androidx.compose.ui.Modifier
 import androidx.compose.ui.tooling.preview.Preview
 import com.example.neurea.navigation.Navigation
 import com.example.neurea.views.ui.theme.NeureaTheme
+import kotlinx.coroutines.flow.MutableStateFlow
 
 class MainActivity : ComponentActivity() {
+    var themeState = mutableStateOf(false)
+
     override fun onCreate(savedInstanceState: Bundle?) {
         super.onCreate(savedInstanceState)
         enableEdgeToEdge()
         setContent {
-            NeureaTheme {
+            NeureaTheme(darkTheme = themeState.value) {
                 Surface(modifier = Modifier
                     .fillMaxSize()){
                     Navigation()

+ 2 - 0
Frontend/app/src/main/java/com/example/neurea/views/screens/SettingsScreen.kt

@@ -67,6 +67,7 @@ fun SettingsScreen() { // navController: NavController
                     .padding(vertical = 80.dp))
             Column(
                 modifier = Modifier
+                    .fillMaxSize()
                     .clip(RoundedCornerShape(45.dp, 45.dp))
                     .background(color = MaterialTheme.colorScheme.secondary)
             ){
@@ -104,6 +105,7 @@ fun SettingsScreen() { // navController: NavController
                         }
                         Column(){
                             var checked by remember { mutableStateOf(false) }
+
                             Switch(
                                 checked = checked,
                                 onCheckedChange = { checked = it },

+ 137 - 0
Frontend/app/src/main/java/com/example/neurea/views/screens/UserScreen.kt

@@ -0,0 +1,137 @@
+package com.example.neurea.views.screens
+
+import androidx.compose.foundation.background
+import androidx.compose.foundation.border
+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.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.shape.RoundedCornerShape
+import androidx.compose.foundation.text.KeyboardOptions
+import androidx.compose.material3.ExperimentalMaterial3Api
+import androidx.compose.material3.HorizontalDivider
+import androidx.compose.material3.Icon
+import androidx.compose.material3.IconButton
+import androidx.compose.material3.MaterialTheme
+import androidx.compose.material3.Switch
+import androidx.compose.material3.SwitchDefaults
+import androidx.compose.material3.Text
+import androidx.compose.material3.TextField
+import androidx.compose.material3.TextFieldDefaults
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.MutableState
+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.draw.clip
+import androidx.compose.ui.graphics.Color
+import androidx.compose.ui.res.painterResource
+import androidx.compose.ui.text.TextStyle
+import androidx.compose.ui.text.font.FontWeight
+import androidx.compose.ui.text.input.KeyboardType
+import androidx.compose.ui.tooling.preview.Preview
+import androidx.compose.ui.unit.dp
+import androidx.compose.ui.unit.sp
+import com.example.neurea.R
+import com.example.neurea.views.ui.theme.NeureaTheme
+
+
+@Preview()
+@OptIn(ExperimentalMaterial3Api::class)
+@Composable
+fun UserScreen() { // navController: NavController
+    var newName by remember{ mutableStateOf("") }
+    var newEmail by remember { mutableStateOf("") }
+    var newBirthday by remember { mutableStateOf("") }
+    val maxLength = 30
+
+    NeureaTheme {
+        Column(
+            modifier = Modifier
+                .fillMaxSize()
+                .background(color = MaterialTheme.colorScheme.surface)
+        ) {
+            Column(
+                modifier = Modifier
+                    .fillMaxWidth()
+                    .height(320.dp),
+                verticalArrangement = Arrangement.Center,
+                horizontalAlignment = Alignment.CenterHorizontally
+
+            ) {
+                Box(
+                    modifier = Modifier
+                        .size(130.dp)
+                        .background(Color.White, RoundedCornerShape(100.dp))
+                        .padding(10.dp)
+                ){
+
+                }
+
+                Text("Имя", fontWeight = FontWeight.ExtraBold, fontSize = 16.sp, modifier = Modifier.padding(vertical = 5.dp) )
+                Text("your@email.com", fontSize = 12.sp)
+
+            }
+            Column(
+                modifier = Modifier
+                    .fillMaxSize()
+                    .clip(RoundedCornerShape(45.dp, 45.dp))
+                    .background(color = MaterialTheme.colorScheme.secondary)
+            ){
+                Text("Имя", fontWeight = FontWeight.Bold, color = MaterialTheme.colorScheme.onPrimary, fontSize = 12.sp, modifier = Modifier.padding(start = 20.dp))
+                TextField(
+                    modifier = Modifier
+                        .fillMaxWidth()
+                        .padding(horizontal = 20.dp, vertical = 8.dp)
+                        .clip(shape = RoundedCornerShape(8.dp))
+                        .border(
+                            width = 1.dp,
+                            color = MaterialTheme.colorScheme.onSecondary,
+                            shape = RoundedCornerShape(12.dp)
+                        ),
+                    textStyle = TextStyle(fontSize = 14.sp),
+                    value = newName,
+                    keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Text),
+                    colors = TextFieldDefaults.textFieldColors(
+                        containerColor = MaterialTheme.colorScheme.secondary,
+                        focusedIndicatorColor = MaterialTheme.colorScheme.secondary,
+                        focusedTextColor = MaterialTheme.colorScheme.onPrimary,
+                        unfocusedTextColor = MaterialTheme.colorScheme.secondary,
+                        disabledIndicatorColor = Color.Transparent,
+                        unfocusedIndicatorColor = Color.Transparent,
+                        cursorColor = MaterialTheme.colorScheme.primary,
+                        disabledPlaceholderColor = MaterialTheme.colorScheme.onSecondary,
+                        focusedPlaceholderColor = MaterialTheme.colorScheme.onSecondary,
+                        unfocusedPlaceholderColor = MaterialTheme.colorScheme.onSecondary
+                    ),
+
+                    onValueChange = {
+                        if (it.length <= maxLength) newName = it
+                        /*if (email.value.isNotEmpty() and emailPattern.matches(email.value)) {
+                        colorOfButton = lavender.value
+                    } else {
+                        colorOfButton = gainsboro.value
+                    }*/
+                    },
+                    placeholder = { Text("Ваше имя", fontSize = 14.sp) },
+                    singleLine = true
+                )
+
+
+
+            }
+
+
+
+        }
+    }
+}