Anastasia 4 dienas atpakaļ
vecāks
revīzija
493bc19793

+ 93 - 2
EatWell/app/src/main/java/com/example/eatwell/view/mainActivity/Dish.kt

@@ -1,5 +1,6 @@
 package com.example.eatwell.view.mainActivity
 
+import androidx.compose.foundation.Image
 import androidx.compose.foundation.background
 import androidx.compose.foundation.layout.Box
 import androidx.compose.foundation.layout.Column
@@ -45,9 +46,12 @@ import androidx.compose.ui.graphics.vector.ImageVector
 import androidx.compose.ui.platform.LocalContext
 import androidx.compose.ui.res.painterResource
 import androidx.compose.ui.res.vectorResource
+import androidx.compose.ui.text.font.FontFamily
 import androidx.compose.ui.text.style.TextAlign
 import androidx.navigation.NavController
+import coil.compose.rememberImagePainter
 import com.example.eatwell.R
+import com.example.eatwell.Resources
 import com.example.eatwell.domain.Constant
 import com.example.eatwell.model.Recipes
 import com.example.eatwell.view.ui.theme.black
@@ -60,6 +64,13 @@ import io.github.jan.supabase.gotrue.auth
 //@Preview
 @Composable
 fun dish(navController: NavController) {
+    var list = remember { mutableStateListOf<Recipes>() }
+    if(!flag) {
+        for (i in 0..Resources.recipes.size - 1) {
+            list.add(Resources.recipes.get(i))
+        }
+        flag = true
+    }
     Box(
         modifier = Modifier
             .fillMaxSize()
@@ -95,13 +106,93 @@ fun dish(navController: NavController) {
                     textAlign = TextAlign.Center,
                     modifier = Modifier
                         .fillMaxWidth()
-                        .padding(bottom = 580.dp)
+                        .padding(bottom = 15.dp)
                 )
+                Box(
+                    modifier = Modifier
+                        .width(359.dp)
+                        .height(550.dp)
+                        .clip(RoundedCornerShape(30.dp))
+                        .background(fon2)
+                        .padding(15.dp)
+
+                ) {
+                    Column(
+                        modifier = Modifier
+                            .size(width = 400.dp, height = 750.dp)
+                            .background(fon2)
+
+                    ) {
+
+                        LazyColumn(
+                            modifier = Modifier.fillMaxSize()
+                        ) {
+
+                            items(list.size) { itemId ->
+                                Image(
+                                    painter = rememberImagePainter(
+                                        list.get(
+                                            itemId
+                                        ).image
+                                    ),
+                                    contentDescription = "Image in LazyRow - $itemId",
+                                    modifier = Modifier
+                                        .padding(
+                                            top = 10.dp,
+                                            bottom = 10.dp,
+                                            start = 7.5.dp,
+                                            end = 7.5.dp
+                                        )
+                                        .fillMaxWidth()
+                                        .height(150.dp)
+                                        .clip(RoundedCornerShape(50.dp))
+                                )
+                                Text(
+                                    modifier = Modifier
+                                        .fillMaxWidth()
+                                        .padding(top = 7.5.dp),
+                                    text = list.get(itemId).name,
+                                    color = Color.Black,
+                                    fontSize = 20.sp,
+                                    fontWeight = FontWeight.Bold,
+                                    fontFamily = FontFamily.Monospace,
+                                    textAlign = TextAlign.Left
+
+                                )
+
+
+                                Text(
+                                    modifier = Modifier
+                                        .fillMaxWidth()
+                                        .padding(top = 7.5.dp),
+                                    text = list.get(itemId).calories,
+                                    color = knopka,
+                                    fontSize = 15.sp,
+                                    fontWeight = FontWeight.Bold,
+                                    fontFamily = FontFamily.Monospace,
+                                    textAlign = TextAlign.Left
+                                )
+                                Text(
+                                    modifier = Modifier
+                                        .fillMaxWidth()
+                                        .padding(top = 7.5.dp),
+                                    text = list.get(itemId).description,
+                                    color = knopka,
+                                    fontSize = 15.sp,
+                                    fontWeight = FontWeight.Bold,
+                                    fontFamily = FontFamily.Monospace,
+                                    textAlign = TextAlign.Left
+                                )
+                            }
+                        }
+                    }
+
+                }
 
                 Button(
                     onClick = {
 
-                        //navController.navigate("Auth")
+                        navController.navigate("fridge")
                     }, Modifier
                         .fillMaxWidth()
                         .padding(vertical = 8.dp, horizontal = 1.dp)

+ 5 - 2
EatWell/app/src/main/java/com/example/eatwell/view/mainActivity/Home.kt

@@ -257,6 +257,7 @@ fun home(navController: NavController) {
                         LazyColumn(
                             modifier = Modifier.fillMaxSize()
                         ) {
+
                             items(list.size) { itemId ->
                                 Image(
                                     painter = rememberImagePainter(
@@ -275,20 +276,22 @@ fun home(navController: NavController) {
                                         .fillMaxWidth()
                                         .height(150.dp)
                                         .clip(RoundedCornerShape(50.dp))
-
                                 )
                                 Text(
                                     modifier = Modifier
                                         .fillMaxWidth()
-                                        .padding(top = 7.5.dp),
+                                        .padding(top = 7.5.dp)
+                                        .clickable { navController.navigate("recept") },
                                     text = list.get(itemId).name,
                                     color = Color.Black,
                                     fontSize = 20.sp,
                                     fontWeight = FontWeight.Bold,
                                     fontFamily = FontFamily.Monospace,
                                     textAlign = TextAlign.Left
+
                                 )
 
+
                                 Text(
                                     modifier = Modifier
                                         .fillMaxWidth()

+ 105 - 11
EatWell/app/src/main/java/com/example/eatwell/view/mainActivity/Recept.kt

@@ -1,5 +1,6 @@
 package com.example.eatwell.view.mainActivity
 
+import androidx.compose.foundation.Image
 import androidx.compose.foundation.background
 import androidx.compose.foundation.layout.Box
 import androidx.compose.foundation.layout.Column
@@ -43,19 +44,32 @@ import androidx.compose.ui.graphics.vector.ImageVector
 import androidx.compose.ui.platform.LocalContext
 import androidx.compose.ui.res.painterResource
 import androidx.compose.ui.res.vectorResource
+import androidx.compose.ui.text.font.FontFamily
 import androidx.compose.ui.text.style.TextAlign
+import androidx.navigation.NavController
 import androidx.navigation.NavHostController
+import coil.compose.rememberImagePainter
 import com.example.eatwell.R
+import com.example.eatwell.Resources
 import com.example.eatwell.domain.Constant
 import com.example.eatwell.model.Recipes
 import com.example.eatwell.view.ui.theme.black
+import com.example.eatwell.view.ui.theme.fon2
+import com.example.eatwell.view.ui.theme.knopka
 import com.example.eatwell.view.ui.theme.text_1
 import io.github.jan.supabase.gotrue.auth
 
 @OptIn(ExperimentalMaterial3Api::class)
 //@Preview
 @Composable
-fun recept(navController: NavHostController) {
+fun recept(navController: NavController) {
+    var list = remember { mutableStateListOf<Recipes>() }
+    if(!flag) {
+        for (i in 0..Resources.recipes.size - 1) {
+            list.add(Resources.recipes.get(i))
+        }
+        flag = true
+    }
     Box(
         modifier = Modifier
             .fillMaxSize()
@@ -92,14 +106,95 @@ fun recept(navController: NavHostController) {
                     textAlign = TextAlign.Center,
                     modifier = Modifier
                         .fillMaxWidth()
-                        .padding(bottom = 1.dp)
+                        .padding(bottom = 10.dp)
                 )
+                Box(
+                    modifier = Modifier
+                        .width(359.dp)
+                        .height(630.dp)
+                        .clip(RoundedCornerShape(30.dp))
+                        .background(fon2)
+                        .padding(15.dp)
+
+                ) {
+                    Column(
+                        modifier = Modifier
+                            .size(width = 400.dp, height = 750.dp)
+                            .background(fon2)
+
+                    ) {
+
+                        LazyColumn(
+                            modifier = Modifier.fillMaxSize()
+                        ) {
+
+                            items(list.size) { itemId ->
+                                Image(
+                                    painter = rememberImagePainter(
+                                        list.get(
+                                            itemId
+                                        ).image
+                                    ),
+                                    contentDescription = "Image in LazyRow - $itemId",
+                                    modifier = Modifier
+                                        .padding(
+                                            top = 10.dp,
+                                            bottom = 10.dp,
+                                            start = 7.5.dp,
+                                            end = 7.5.dp
+                                        )
+                                        .fillMaxWidth()
+                                        .height(150.dp)
+                                        .clip(RoundedCornerShape(50.dp))
+                                )
+                                Text(
+                                    modifier = Modifier
+                                        .fillMaxWidth()
+                                        .padding(top = 7.5.dp),
+                                    text = list.get(itemId).name,
+                                    color = Color.Black,
+                                    fontSize = 20.sp,
+                                    fontWeight = FontWeight.Bold,
+                                    fontFamily = FontFamily.Monospace,
+                                    textAlign = TextAlign.Left
+
+                                )
+
+
+                                Text(
+                                    modifier = Modifier
+                                        .fillMaxWidth()
+                                        .padding(top = 7.5.dp),
+                                    text = list.get(itemId).calories,
+                                    color = knopka,
+                                    fontSize = 15.sp,
+                                    fontWeight = FontWeight.Bold,
+                                    fontFamily = FontFamily.Monospace,
+                                    textAlign = TextAlign.Left
+                                )
+                                Text(
+                                    modifier = Modifier
+                                        .fillMaxWidth()
+                                        .padding(top = 7.5.dp),
+                                    text = list.get(itemId).description,
+                                    color = knopka,
+                                    fontSize = 15.sp,
+                                    fontWeight = FontWeight.Bold,
+                                    fontFamily = FontFamily.Monospace,
+                                    textAlign = TextAlign.Left
+                                )
+                            }
+                        }
+                    }
+
+                }
+
 
                 Column(
                     modifier = Modifier
                         .fillMaxSize()
                         .background(white)
-                        .padding(top = 670.dp, start = 15.dp, end = 15.dp)
+                        .padding(top = 30.dp, start = 15.dp, end = 15.dp)
                 ) {
                     Box(
                         modifier = Modifier
@@ -138,7 +233,7 @@ fun recept(navController: NavHostController) {
                             ) {
                                 IconButton(
                                     onClick = {
-                                        navController.navigate("MyPlan")
+                                        //navController.navigate("MyPlan")
                                         {
                                         }
                                     }, modifier = Modifier.size(32.dp)
@@ -158,7 +253,7 @@ fun recept(navController: NavHostController) {
                             ) {
                                 IconButton(
                                     onClick = {
-                                        navController.navigate("Fridge")
+                                        //navController.navigate("Fridge")
                                         {
                                         }
                                     }, modifier = Modifier.size(32.dp)
@@ -178,7 +273,7 @@ fun recept(navController: NavHostController) {
                             ) {
                                 IconButton(
                                     onClick = {
-                                        navController.navigate("Auth")
+                                        //navController.navigate("Auth")
                                         {
                                         }
                                     }, modifier = Modifier.size(32.dp)
@@ -195,8 +290,7 @@ fun recept(navController: NavHostController) {
                             }
                         }
                     }
-                }
-            }
-        }
-    }
-}
+                }}}}}
+
+
+