Browse Source

frontend: Внес правки в BookScreen, начал писать RedingScreen

ZryachevTA 6 days ago
parent
commit
af4d2d7589

+ 5 - 1
Frontend/app/src/main/java/com/example/neurea/navigation/Navigation.kt

@@ -7,6 +7,7 @@ import androidx.navigation.compose.NavHost
 import androidx.navigation.compose.composable
 import androidx.navigation.compose.rememberNavController
 import com.example.neurea.views.screens.AuthorizationScreen
+import com.example.neurea.views.screens.BookScreen
 import com.example.neurea.views.screens.SplashScreen
 
 @Composable
@@ -19,7 +20,10 @@ fun Navigation(){
             SplashScreen(navController = navController)
         }
         composable("authorizationScreen"){
-            AuthorizationScreen() //navController = navController
+            AuthorizationScreen(navController) //navController = navController
+        }
+        composable("bookScreen"){
+            BookScreen()
         }
     }
 

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

@@ -51,7 +51,7 @@ import com.example.neurea.views.ui.theme.NeureaTheme
 @Preview()
 @OptIn(ExperimentalMaterial3Api::class)
 @Composable
-fun AuthorizationScreen() { // navController: NavController
+fun AuthorizationScreen(navController: NavController) { // navController: NavController
     var email = remember { mutableStateOf("") }
     var password = remember { mutableStateOf("") }
     val maxLength = 20
@@ -166,6 +166,7 @@ fun AuthorizationScreen() { // navController: NavController
 
             Button(
                 onClick = {
+                    navController.navigate("bookScreen")
                 },
                 modifier = Modifier
                     .fillMaxWidth()

+ 56 - 3
Frontend/app/src/main/java/com/example/neurea/views/screens/BookScreen.kt

@@ -6,16 +6,20 @@ 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.PaddingValues
 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.size
 import androidx.compose.foundation.layout.width
+import androidx.compose.foundation.rememberScrollState
 import androidx.compose.foundation.shape.CircleShape
 import androidx.compose.foundation.shape.RoundedCornerShape
 import androidx.compose.foundation.text.KeyboardOptions
+import androidx.compose.foundation.verticalScroll
 import androidx.compose.material3.Button
 import androidx.compose.material3.ButtonDefaults
 import androidx.compose.material3.ExperimentalMaterial3Api
@@ -99,12 +103,16 @@ fun BookScreen() { // navController: NavController
             Column(
                 modifier = Modifier
                     .fillMaxWidth()
-                    .height(265.dp),
+                    .height(245.dp)
+                    ,
                 verticalArrangement = Arrangement.Center,
                 horizontalAlignment = Alignment.CenterHorizontally
 
             ) {
-                Box(modifier = Modifier.height(200.dp).width(150.dp).background(Color.Gray)){
+                Box(modifier = Modifier
+                    .height(200.dp)
+                    .width(150.dp)
+                    .background(Color.Gray)){
 
                 }
 
@@ -115,12 +123,57 @@ fun BookScreen() { // navController: NavController
                     .clip(RoundedCornerShape(45.dp, 45.dp))
                     .background(color = MaterialTheme.colorScheme.secondary)
                     .padding(start = 20.dp, end = 20.dp)
+                    .verticalScroll(rememberScrollState())
             ){
                 Text("Автостопом по галактике", modifier = Modifier.padding(top=25.dp, bottom = 5.dp), fontWeight = FontWeight.Bold, fontSize = 20.sp)
                 Text("Дуглас Адамс", fontSize = 16.sp, color = MaterialTheme.colorScheme.onSecondary)
                 Text("Аннотация", modifier = Modifier.padding(top=15.dp, bottom = 5.dp), fontWeight = FontWeight.Bold, fontSize = 20.sp)
                 Text("«Автостопом по Галактике», стартовав в качестве радиопостановки на Би-би-си, имел грандиозный успех. Одноименный роман в 1984 году возглавил список английских бестселлеров, а сам Адамс стал самым молодым писателем, получившим награду «Золотая ручка», вручаемую за 1 млн. проданных книг.\u2028Телепостановка 1982 года упрочила успех серии книг про «Автостоп», а полнометражный фильм 2005 года при бюджете в \$50 млн. дважды «отбил» расходы на экранизацию и был номинирован на 7 премий.",
-                    textAlign = TextAlign.Justify)
+                    textAlign = TextAlign.Justify, fontSize = 16.sp)
+                Text("Жанры", modifier = Modifier.padding(top=15.dp, bottom = 5.dp), fontWeight = FontWeight.Bold, fontSize = 20.sp)
+                Row(){
+                    Button(onClick = {}, colors = ButtonDefaults.buttonColors(containerColor = MaterialTheme.colorScheme.surface), modifier = Modifier.padding(end = 5.dp))
+                    {
+                        Text("Научная фантастика", color = MaterialTheme.colorScheme.onSecondary, fontSize = 12.sp)
+                    }
+                    Button(onClick = {}, colors = ButtonDefaults.buttonColors(containerColor = MaterialTheme.colorScheme.surface))
+                    {
+                        Text("Комедия", color = MaterialTheme.colorScheme.onSecondary, fontSize = 12.sp)
+                    }
+                }
+                Row(modifier = Modifier
+                    .padding(top = 15.dp)
+                    .fillMaxWidth(), horizontalArrangement = Arrangement.SpaceBetween, verticalAlignment = Alignment.CenterVertically){
+                    Row(modifier = Modifier
+                        .clip(RoundedCornerShape(20.dp))
+                        .background(MaterialTheme.colorScheme.surface)){
+                        Column(modifier = Modifier.padding(vertical = 7.dp, horizontal = 7.dp),
+                        ){
+                            Text("Прочитаете за:", color = MaterialTheme.colorScheme.onSecondary, fontSize = 15.sp)
+                        }
+                        Column(modifier = Modifier
+                            .clip(RoundedCornerShape(20.dp))
+                            .padding(start = 0.dp)
+                            .background(MaterialTheme.colorScheme.secondary)
+                            .border(
+                                2.dp,
+                                MaterialTheme.colorScheme.primary,
+                                shape = RoundedCornerShape(20.dp)
+                            )
+                            .padding(vertical = 7.dp, horizontal = 17.dp),
+                        ){
+                            Text("9ч. 20мин.", color = MaterialTheme.colorScheme.primary, fontSize = 15.sp, fontWeight = FontWeight.Bold)
+                        }
+
+
+                    }
+                    Button(onClick = {}, colors = ButtonDefaults.buttonColors(containerColor = MaterialTheme.colorScheme.primary))
+                    {
+                        Text("Читать", color = MaterialTheme.colorScheme.secondary, fontSize = 15.sp,  fontWeight = FontWeight.Bold)
+                    }
+                }
+                Spacer(modifier = Modifier.height(25.dp))
+
 
             }
 

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

@@ -0,0 +1,75 @@
+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.Column
+import androidx.compose.foundation.layout.PaddingValues
+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.shape.RoundedCornerShape
+import androidx.compose.foundation.text.KeyboardOptions
+import androidx.compose.material3.Button
+import androidx.compose.material3.ButtonDefaults
+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.Slider
+import androidx.compose.material3.SliderDefaults
+import androidx.compose.material3.Text
+import androidx.compose.material3.TextButton
+import androidx.compose.material3.TextField
+import androidx.compose.material3.TextFieldDefaults
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableFloatStateOf
+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.text.input.PasswordVisualTransformation
+import androidx.compose.ui.text.input.VisualTransformation
+import androidx.compose.ui.text.style.TextAlign
+import androidx.compose.ui.tooling.preview.Preview
+import androidx.compose.ui.unit.dp
+import androidx.compose.ui.unit.sp
+import androidx.navigation.NavController
+import com.example.neurea.R
+import com.example.neurea.views.ui.theme.NeureaTheme
+
+@Preview()
+@OptIn(ExperimentalMaterial3Api::class)
+@Composable
+fun ReadingScreen() { // navController: NavController
+
+    NeureaTheme {
+        Column(
+            modifier = Modifier
+                .fillMaxSize()
+                .background(color = MaterialTheme.colorScheme.secondary)
+        ) {
+            var sliderPosition by remember { mutableFloatStateOf(0f) }
+            Column {
+                Slider(
+                    value = sliderPosition,
+                    onValueChange = { sliderPosition = it },
+                    colors = SliderDefaults.colors(thumbColor = MaterialTheme.colorScheme.primary, inactiveTickColor = MaterialTheme.colorScheme.onSecondary)
+                )
+                Text(text = sliderPosition.toString())
+            }
+
+        }
+    }
+}