Compare commits
2 Commits
68446fa3cf
...
0dc8ebc564
Author | SHA1 | Date | |
---|---|---|---|
0dc8ebc564 | |||
f568e491ea |
@ -16,6 +16,7 @@ import com.example.shawarma.screens.authorization.AuthorizationScreen
|
||||
import com.example.shawarma.screens.cart.CartScreen
|
||||
import com.example.shawarma.screens.discount.DiscountScreen
|
||||
import com.example.shawarma.screens.home.HomeScreen
|
||||
import com.example.shawarma.screens.orders.OrdersScreen
|
||||
import com.example.shawarma.screens.registration.RegistrationScreen
|
||||
import com.example.shawarma.ui.theme.MyLightYellow
|
||||
import com.example.shawarma.utils.ScreenPaths
|
||||
@ -52,6 +53,9 @@ fun MainNavBar() {
|
||||
composable(ScreenPaths.cart.name) {
|
||||
CartScreen()
|
||||
}
|
||||
composable(ScreenPaths.orders.name) {
|
||||
OrdersScreen()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,17 +1,155 @@
|
||||
package com.example.shawarma.screens.home
|
||||
|
||||
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.ButtonColors
|
||||
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.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import androidx.compose.ui.zIndex
|
||||
import com.example.shawarma.R
|
||||
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 HomeScreen() {
|
||||
Box(
|
||||
contentAlignment = Alignment.Center
|
||||
contentAlignment = Alignment.TopCenter
|
||||
) {
|
||||
HomeList()
|
||||
ShawarmaLogo2()
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun HomeList(){
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.clip(shape = RoundedCornerShape(30.dp))
|
||||
.padding(top = 100.dp)
|
||||
.fillMaxSize()
|
||||
.background(color = MyMainBackground)
|
||||
.zIndex(2f),
|
||||
|
||||
contentAlignment = Alignment.TopCenter
|
||||
){
|
||||
Text(
|
||||
text = "Home"
|
||||
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)
|
||||
) {
|
||||
ProductCard()
|
||||
ProductCard()
|
||||
}
|
||||
|
||||
// TODO Потом переделать под реальный объем данных
|
||||
if (index == 2) {
|
||||
Spacer(modifier = Modifier.height(70.dp))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun ProductCard(){
|
||||
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(
|
||||
){
|
||||
Text(
|
||||
text = "150 руб. ",
|
||||
fontFamily = NunitoFamily,
|
||||
fontSize = 16.sp,
|
||||
fontWeight = FontWeight.ExtraBold,
|
||||
modifier = Modifier.padding(start = 12.dp, top = 6.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,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package com.example.shawarma.screens.orders
|
||||
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.material.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
|
||||
@Composable
|
||||
fun OrdersScreen() {
|
||||
Box(
|
||||
contentAlignment = Alignment.Center
|
||||
) {
|
||||
Text(
|
||||
text = "Orders"
|
||||
)
|
||||
}
|
||||
}
|
@ -5,3 +5,6 @@ import androidx.compose.ui.graphics.Color
|
||||
val MyLightYellow = Color(255,225,120,255)
|
||||
val MyLightRed = Color(255,100,100,255)
|
||||
val MyTextFieldBackground = Color(232,232,232,255)
|
||||
val MyPriceBackground = Color(0xFFE8E8E8)
|
||||
val MyMainBackground = Color(0x80FFFFFF)
|
||||
val MyOrange = Color(0xFFFF9600)
|
||||
|
@ -32,3 +32,10 @@ val Typography = Typography(
|
||||
val JejuFamily = FontFamily(
|
||||
Font(R.font.jejugothic_regular, FontWeight.Normal)
|
||||
)
|
||||
|
||||
val MarckFamily = FontFamily(
|
||||
Font(R.font.marckscript_regular, FontWeight.Normal)
|
||||
)
|
||||
val NunitoFamily = FontFamily(
|
||||
Font(R.font.nunito_wght, FontWeight.Normal)
|
||||
)
|
@ -6,4 +6,5 @@ sealed class BottomNavItem(var title:String, var icon:Int, var screen_route:Stri
|
||||
object Home : BottomNavItem("Home", R.drawable.home_icon,ScreenPaths.home.name)
|
||||
object Discount : BottomNavItem("Discount", R.drawable.discount_icon,ScreenPaths.discount.name)
|
||||
object Cart : BottomNavItem("Cart", R.drawable.cart_icon,ScreenPaths.cart.name)
|
||||
object Orders: BottomNavItem("Orders", R.drawable.orders_icon,ScreenPaths.orders.name)
|
||||
}
|
||||
|
@ -1,13 +1,17 @@
|
||||
package com.example.shawarma.widgets
|
||||
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.material.BottomNavigation
|
||||
import androidx.compose.material.BottomNavigationItem
|
||||
import androidx.compose.material.Icon
|
||||
import androidx.compose.material.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import androidx.navigation.NavController
|
||||
import androidx.navigation.compose.currentBackStackEntryAsState
|
||||
@ -16,24 +20,25 @@ import com.example.shawarma.utils.BottomNavItem
|
||||
@Composable
|
||||
fun BottomNavBar(navController: NavController) {
|
||||
val items = listOf(
|
||||
BottomNavItem.Home,
|
||||
BottomNavItem.Discount,
|
||||
BottomNavItem.Home,
|
||||
BottomNavItem.Cart,
|
||||
BottomNavItem.Orders
|
||||
)
|
||||
BottomNavigation(
|
||||
backgroundColor = Color.Green,
|
||||
contentColor = Color.Cyan
|
||||
|
||||
backgroundColor = Color.White,
|
||||
contentColor = Color.Black,
|
||||
modifier = Modifier.height(60.dp)
|
||||
) {
|
||||
val navBackStackEntry by navController.currentBackStackEntryAsState()
|
||||
val currentRoute = navBackStackEntry?.destination?.route
|
||||
items.forEach { item ->
|
||||
BottomNavigationItem(
|
||||
icon = { Icon(painterResource(id = item.icon), contentDescription = item.title) },
|
||||
label = {
|
||||
Text(
|
||||
text = item.title,
|
||||
fontSize = 9.sp
|
||||
icon = {
|
||||
Icon(
|
||||
painterResource(id = item.icon),
|
||||
contentDescription = item.title,
|
||||
modifier = Modifier.size(42.dp)
|
||||
) },
|
||||
selectedContentColor = Color.Black,
|
||||
unselectedContentColor = Color.Black.copy(0.4f),
|
||||
@ -49,7 +54,8 @@ fun BottomNavBar(navController: NavController) {
|
||||
launchSingleTop = true
|
||||
restoreState = true
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,30 @@
|
||||
package com.example.shawarma.widgets
|
||||
|
||||
import androidx.compose.foundation.Image
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.zIndex
|
||||
import com.example.shawarma.R
|
||||
|
||||
@Composable
|
||||
fun ShawarmaLogo2() {
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.zIndex(-1f)
|
||||
.fillMaxSize(),
|
||||
horizontalAlignment = Alignment.CenterHorizontally
|
||||
) {
|
||||
Image(
|
||||
painter = painterResource(id = R.drawable.shawarma1),
|
||||
contentDescription = null,
|
||||
modifier = Modifier
|
||||
.size(256.dp, 256.dp)
|
||||
)
|
||||
}
|
||||
}
|
BIN
app/src/main/res/drawable/orders_icon.png
Normal file
BIN
app/src/main/res/drawable/orders_icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 937 B |
BIN
app/src/main/res/drawable/shawarma2.png
Normal file
BIN
app/src/main/res/drawable/shawarma2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 13 KiB |
BIN
app/src/main/res/font/marckscript_regular.ttf
Normal file
BIN
app/src/main/res/font/marckscript_regular.ttf
Normal file
Binary file not shown.
BIN
app/src/main/res/font/nunito_wght.ttf
Normal file
BIN
app/src/main/res/font/nunito_wght.ttf
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user