From 245b8597722e5ddd278366ab66dc7a1ab557ce79 Mon Sep 17 00:00:00 2001 From: Danya_Mochalov Date: Tue, 10 Oct 2023 02:48:06 +0400 Subject: [PATCH] =?UTF-8?q?=D0=AD=D0=BA=D1=80=D0=B0=D0=BD=20=D1=81=D0=BE?= =?UTF-8?q?=20=D1=81=D0=BA=D0=B8=D0=B4=D0=BA=D0=B0=D0=BC=D0=B8=20=D0=B3?= =?UTF-8?q?=D0=BE=D1=82=D0=BE=D0=B2.=20[=D0=A1=D0=BF=D0=B0=D1=81=D0=B8?= =?UTF-8?q?=D1=82=D0=B5,=20=D1=8F=20=D0=BD=D0=B5=20=D0=B2=D1=8B=D0=B2?= =?UTF-8?q?=D0=BE=D0=B6=D1=83...=20=D1=85=D0=BE=D1=87=D1=83=20=D0=BF=D1=80?= =?UTF-8?q?=D0=BE=D1=81=D1=82=D0=BE=20=D1=81=D0=BC=D0=BE=D1=82=D1=80=D0=B5?= =?UTF-8?q?=D1=82=D1=8C=20=D0=B2=D0=B0=D0=BD=20=D0=BF=D0=B8=D1=81=20=D0=B8?= =?UTF-8?q?=20=D0=BA=D1=83=D1=88=D0=B0=D1=82=D1=8C=20=D1=87=D0=B8=D0=BF?= =?UTF-8?q?=D1=81=D1=8B...=20;(=20=20]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/misc.xml | 1 - .../screens/discount/DiscountScreen.kt | 159 +++++++++++++++++- 2 files changed, 156 insertions(+), 4 deletions(-) diff --git a/.idea/misc.xml b/.idea/misc.xml index b0137f1..ac801d8 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,4 +1,3 @@ - diff --git a/app/src/main/java/com/example/shawarma/screens/discount/DiscountScreen.kt b/app/src/main/java/com/example/shawarma/screens/discount/DiscountScreen.kt index 1d34053..a6b066e 100644 --- a/app/src/main/java/com/example/shawarma/screens/discount/DiscountScreen.kt +++ b/app/src/main/java/com/example/shawarma/screens/discount/DiscountScreen.kt @@ -1,17 +1,170 @@ package com.example.shawarma.screens.discount +import androidx.compose.foundation.BorderStroke +import androidx.compose.foundation.Image +import androidx.compose.foundation.background +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.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.lazy.LazyColumn +import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.material.Button +import androidx.compose.material.ButtonDefaults +import androidx.compose.material.Card import androidx.compose.material.Text import androidx.compose.runtime.Composable 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.font.FontWeight +import androidx.compose.ui.text.style.TextDecoration +import androidx.compose.ui.unit.dp +import androidx.compose.ui.unit.sp +import androidx.compose.ui.zIndex +import com.example.shawarma.R +import com.example.shawarma.screens.home.HomeList +import com.example.shawarma.ui.theme.MarckFamily +import com.example.shawarma.ui.theme.MyLightYellow +import com.example.shawarma.ui.theme.MyMainBackground +import com.example.shawarma.ui.theme.MyOrange +import com.example.shawarma.ui.theme.MyPriceBackground +import com.example.shawarma.ui.theme.NunitoFamily +import com.example.shawarma.widgets.ShawarmaLogo2 @Composable fun DiscountScreen() { + Box( + contentAlignment = Alignment.TopCenter + ) { + DiscountList() + ShawarmaLogo2() + } + +} + +@Composable +fun DiscountList(){ Box( - contentAlignment = Alignment.Center - ) { + modifier = Modifier + .clip(shape = RoundedCornerShape(30.dp)) + .padding(top = 100.dp) + .fillMaxSize() + .background(color = MyMainBackground) + .zIndex(2f), + + contentAlignment = Alignment.TopCenter + ){ Text( - text = "Discount" + text = "Акции", + fontFamily = MarckFamily, + fontSize = 40.sp, + modifier = Modifier.padding(top = 15.dp) ) + LazyColumn( + horizontalAlignment = Alignment.CenterHorizontally, + modifier = Modifier.padding(top = 80.dp) + ) + { + items(3) { index -> + Row( + horizontalArrangement = Arrangement.SpaceAround, + modifier = Modifier + .fillMaxWidth() + .padding(top = 10.dp) + ) { + DiscountCard() + DiscountCard() + } + + // TODO Потом переделать под реальный объем данных + if (index == 2) { + Spacer(modifier = Modifier.height(70.dp)) + } + } + } + } +} + +@Composable +fun DiscountCard(){ + Card( + shape = RoundedCornerShape(20.dp), + backgroundColor = Color.White, + border = BorderStroke(2.dp, MyOrange), + modifier = Modifier + .size(160.dp) + ) { + Column( + horizontalAlignment = Alignment.CenterHorizontally + ) { + Text( + text = "Классика", + fontFamily = NunitoFamily, + fontSize = 20.sp, + fontWeight = FontWeight.Bold, + modifier = Modifier.padding(top = 10.dp) + ) + Image( + painter = painterResource(id = R.drawable.shawarma2), + contentDescription = "Shawarma", + Modifier.size(135.dp, 70.dp) + ) + Spacer(modifier = Modifier.height(16.dp)) + Card( + shape = RoundedCornerShape(20.dp), + backgroundColor = MyPriceBackground, + border = BorderStroke(2.dp, MyOrange), + modifier = Modifier + .size(160.dp, 36.dp) + ) { + Row( + ){ + Box( + modifier = Modifier.padding(start = 12.dp) + ) { + Text( + text = "150 руб. ", + fontFamily = NunitoFamily, + fontSize = 10.sp, + fontWeight = FontWeight.Bold, + textDecoration = TextDecoration.LineThrough + ) + Text( + text = "120 руб. ", + fontFamily = NunitoFamily, + fontSize = 16.sp, + fontWeight = FontWeight.ExtraBold, + color = Color.Red, + modifier = Modifier.padding(top = 8.dp) + ) + } + + Button( + onClick = { /*TODO*/ }, + colors = ButtonDefaults.buttonColors( + backgroundColor = MyLightYellow, + contentColor = Color.Black + ), + shape = RoundedCornerShape(20.dp), + ) { + Text( + text = "Купить", + fontSize = 14.sp, + fontWeight = FontWeight.ExtraBold, + fontFamily = NunitoFamily, + ) + } + } + } + } } } \ No newline at end of file