Ver código fonte

Холодильник, БД

Anastasia 2 dias atrás
pai
commit
cbe1abbd1b

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

@@ -64,6 +64,245 @@ import io.github.jan.supabase.gotrue.auth
 //@Preview
 @Composable
 fun fridge(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) //   .shadow(elevation = 10.dp, shape = RoundedCornerShape(30.dp))
+                .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 = 50.dp)
+                )
+
+                Text(
+                    text = "Что у тебя в холодильнике?  ",
+                    fontSize = 18.sp,
+                    fontWeight = FontWeight.Bold,
+                    color = black,
+                    textAlign = TextAlign.Left,
+                    modifier = Modifier
+                        .fillMaxWidth()
+                        .padding(bottom = 30.dp)
+                )
+                Text(
+                    text = "Добавьте ингредиенты имеющиеся в вашем холодильнике, и мы поможем Вам найти рецепты. ",
+                    fontSize = 18.sp,
+                    fontWeight = FontWeight.Normal,
+                    color = black,
+                    textAlign = TextAlign.Left,
+                    modifier = Modifier
+                        .fillMaxWidth()
+                        .padding(bottom = 30.dp)
+                )
+                val context = LocalContext.current
+
+                Button(
+                    onClick = {
+
+                        navController.navigate("ingredients")
+                        Log.d("Нажали ", " ")
+                    }, 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
+                    )
+                }
+                Button(
+                    onClick = {
+                        navController.navigate("dish")
+
+                    }, 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
+                    )
+                }
+                Text(
+                    text = "Мои продукты",
+                    fontSize = 18.sp,
+                    fontWeight = FontWeight.Normal,
+                    color = black,
+                    textAlign = TextAlign.Left,
+                    modifier = Modifier
+                        .fillMaxWidth()
+                        .padding(bottom = 20.dp)
+                )
+                Box(
+                    modifier = Modifier
+                        .width(359.dp)
+                        .height(270.dp)
+                        .clip(RoundedCornerShape(30.dp))
+                        .background(fon2)
+                        .padding(50.dp)
+
+
+                ) {
+                    var list = Resources.chosenIngredients
+                    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.remove(
+                                        item
+                                    )
+                                }) {
+
+                                }
+                            }
+                        }
+                    }
+                }
+
+
+                Column(
+                    modifier = Modifier
+                        .fillMaxSize()
+                        .background(white)
+                        .padding(top = 15.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)
+                            }
+
+                            // Элемент "FRIGE"
+                            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)
+                            }
+                        }
+                    }
+                }
+            }
+        }
+    }
+
 }