Browse Source

Ингредиенты, БД

Anastasia 6 days ago
parent
commit
a1ae4197fb

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

@@ -64,5 +64,6 @@ import io.github.jan.supabase.gotrue.auth
 //@Preview
 @Composable
 fun fridge(navController: NavController) {
-   
+
+
 }

+ 178 - 0
EatWell/app/src/main/java/com/example/eatwell/view/mainActivity/Ingredients.kt

@@ -66,5 +66,183 @@ import io.github.jan.supabase.gotrue.auth
 //@Preview
 @Composable
 fun ingredients(navController: NavController) {
+    Box(
+        modifier = Modifier
+            .fillMaxSize()
+            .background(fon)
+    ) {
+        Box(
+            modifier = Modifier
+                .fillMaxSize()
+                .background(fon)
+        )
+        Box(
+            modifier = Modifier
+                .width(359.dp)
+                .height(800.dp)
+                .clip(RoundedCornerShape(30.dp))
+                .background(white)
+                .align(Alignment.Center)
+                .padding(16.dp)
 
+
+        ) {
+            Column(
+                modifier = Modifier
+                    .fillMaxSize()
+                    .background(white)
+                    .padding(top = 10.dp, start = 15.dp, end = 15.dp)
+            ) {
+                Text(
+                    text = "Ингредиенты",
+                    fontSize = 20.sp,
+                    fontWeight = FontWeight.Bold,
+                    color = black,
+                    textAlign = TextAlign.Center,
+                    modifier = Modifier
+                        .fillMaxWidth()
+                        .padding(bottom = 20.dp)
+                )
+                Box(
+                    modifier = Modifier
+                        .width(359.dp)
+                        .height(560.dp)
+                        .clip(RoundedCornerShape(30.dp))
+                        .background(fon2)
+                        .padding(50.dp)
+                ) {
+
+                    var list = Resources.ingredients
+                    LazyColumn(
+                        modifier = Modifier
+                            .fillMaxSize(),
+                        verticalArrangement = Arrangement.spacedBy(16.dp)
+                    ) {
+                        items(list) { item ->
+                            Row(
+                                modifier = Modifier
+                                    .fillMaxWidth(),
+                                horizontalArrangement = Arrangement.SpaceBetween
+                            ) {
+                                Image(
+                                    painter = rememberImagePainter(item.image),
+                                    contentDescription = "Image in Row",
+                                    modifier = Modifier
+                                        .size(50.dp)
+                                )
+                                Text(
+                                    text = item.name,
+                                    modifier = Modifier,
+
+                                    color = Color.Black,
+                                    fontSize = 16.sp,
+                                    fontWeight = FontWeight.Bold,
+                                    fontFamily = FontFamily.Monospace
+                                )
+                                Button(onClick = {
+                                    Resources.chosenIngredients.add(
+                                        item
+                                    )
+                                }) {
+
+                                }
+                            }
+                        }
+                    }
+                }
+
+                Button(
+                    onClick = {
+                        navController.navigate("fridge")
+                    }, Modifier
+                        .fillMaxWidth()
+                        .padding(vertical = 8.dp, horizontal = 1.dp)
+                        .height(55.dp)
+                        .background(Color.Transparent),
+                    shape = RoundedCornerShape(20.dp),
+
+
+                    colors = ButtonDefaults.buttonColors(containerColor = knopka)
+                ) {
+                    Text(
+                        "Назад",
+                        fontSize = 20.sp,
+                        color = white,
+                        fontWeight = FontWeight.SemiBold
+                    )
+                }
+                Column(
+                    modifier = Modifier
+                        .fillMaxSize()
+                        .background(white)
+                        .padding(top = 20.dp, start = 15.dp, end = 15.dp)
+                ) {
+                    Box(
+                        modifier = Modifier
+                            .fillMaxWidth()
+                            .padding(bottom = 1.dp)
+                    ) {
+                        Divider(
+                            modifier = Modifier
+                                .fillMaxWidth()
+                                .height(1.dp)
+                                .background(fon)
+                        )
+                        Row(
+                            modifier = Modifier
+                                .fillMaxWidth()
+                                .padding(top = 8.dp),
+                            horizontalArrangement = Arrangement.SpaceBetween,
+                            verticalAlignment = Alignment.CenterVertically
+                        ) {
+                            Column(
+                                horizontalAlignment = Alignment.CenterHorizontally
+                            ) {
+                                Icon(
+                                    painter = painterResource(id = R.drawable.img),
+                                    contentDescription = "Home",
+                                    tint = text_1
+                                )
+                                Spacer(modifier = Modifier.height(4.dp))
+                                Text("HOME", color = text_1)
+                            }
+                            Column(
+                                horizontalAlignment = Alignment.CenterHorizontally
+                            ) {
+                                Icon(
+                                    painter = painterResource(id = R.drawable.img_1),
+                                    contentDescription = "My Plan",
+                                    tint = text_1
+                                )
+                                Spacer(modifier = Modifier.height(4.dp))
+                                Text("MY PLAN", color = text_1)
+                            }
+                            Column(
+                                horizontalAlignment = Alignment.CenterHorizontally
+                            ) {
+                                Icon(
+                                    painter = painterResource(id = R.drawable.img_2),
+                                    contentDescription = "Fridge",
+                                    tint = Color.Black
+                                )
+                                Spacer(modifier = Modifier.height(4.dp))
+                                Text("FRIGE", color = Color.Black)
+                            }
+                            Column(
+                                horizontalAlignment = Alignment.CenterHorizontally
+                            ) {
+                                Icon(
+                                    painter = painterResource(id = R.drawable.img_3),
+                                    contentDescription = "Log Out",
+                                    tint = text_1
+                                )
+                                Spacer(modifier = Modifier.height(4.dp))
+                                Text("LOG OUT", color = text_1)
+                            }
+                        }
+                    }
+                }
+            }
+        }
+    }
 }