12.11
This commit is contained in:
parent
27064d323b
commit
9fd9110d90
@ -1,17 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="deploymentTargetDropDown">
|
||||
<runningDeviceTargetSelectedWithDropDown>
|
||||
<Target>
|
||||
<type value="RUNNING_DEVICE_TARGET" />
|
||||
<deviceKey>
|
||||
<Key>
|
||||
<type value="VIRTUAL_DEVICE_PATH" />
|
||||
<value value="C:\Users\romai\.android\avd\Pixel_3a_API_34_extension_level_7_x86_64.avd" />
|
||||
</Key>
|
||||
</deviceKey>
|
||||
</Target>
|
||||
</runningDeviceTargetSelectedWithDropDown>
|
||||
<timeTargetWasSelectedWithDropDown value="2023-11-10T22:33:40.539545300Z" />
|
||||
</component>
|
||||
</project>
|
@ -0,0 +1,8 @@
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.navigation.NavController
|
||||
|
||||
@Composable
|
||||
fun Authorization() {
|
||||
|
||||
}
|
@ -0,0 +1,63 @@
|
||||
import androidx.compose.foundation.BorderStroke
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.material3.Button
|
||||
import androidx.compose.material3.ButtonDefaults
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import androidx.navigation.NavController
|
||||
import androidx.navigation.compose.rememberNavController
|
||||
import com.example.myapplication.R
|
||||
|
||||
@Composable
|
||||
fun Cart(navController: NavController){
|
||||
|
||||
LazyColumn {
|
||||
item {
|
||||
Text(
|
||||
text = "Корзина: ",
|
||||
fontSize = 28.sp,
|
||||
color = Color.Black,
|
||||
modifier = Modifier.padding(8.dp)
|
||||
)
|
||||
}
|
||||
item {
|
||||
ProductCardInCart("Intel Celeron G5905 OEM", 4099, R.drawable.product3)
|
||||
}
|
||||
item {
|
||||
ProductCardInCart("MSI GeForce RTX 4090 VENTUS 3X OC", 210999, R.drawable.product1)
|
||||
}
|
||||
item {
|
||||
ProductCardInCart("Palit GeForce GTX 1660 SUPER", 25999, R.drawable.product2)
|
||||
}
|
||||
item {
|
||||
Button(
|
||||
onClick = { },
|
||||
modifier = Modifier.fillMaxWidth().padding(top = 20.dp, bottom = 20.dp),
|
||||
border = BorderStroke(1.dp, Color.Black),
|
||||
colors = ButtonDefaults.buttonColors(
|
||||
containerColor = Color.Magenta,
|
||||
)
|
||||
) {
|
||||
TextNice("Оплатить: 240 097 рублей")
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Preview(showBackground = true)
|
||||
@Composable
|
||||
fun CartPreview() {
|
||||
// Создаем заглушку для NavController
|
||||
val navController = rememberNavController()
|
||||
|
||||
// Выводим превью компонента
|
||||
Cart(navController = navController)
|
||||
}
|
@ -21,10 +21,10 @@ fun Catalog(navController: NavController){
|
||||
Column(modifier = Modifier.fillMaxWidth().padding(start = 10.dp, end = 10.dp, top = 20.dp, ),
|
||||
horizontalAlignment = Alignment.End
|
||||
){
|
||||
CatalogItem(text = "Видеокарты",navController, "videocards")
|
||||
CatalogItem(text = "Процессоры",navController, "processors")
|
||||
CatalogItem(text = "ПЗУ",navController, "videocards")
|
||||
CatalogItem(text = "ОЗУ",navController, "videocards")
|
||||
CatalogItem(text = "Видеокарты", navController, "videocards")
|
||||
CatalogItem(text = "Процессоры", navController, "processors")
|
||||
CatalogItem(text = "ПЗУ", navController, "processors")
|
||||
CatalogItem(text = "ОЗУ", navController, "processors")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -46,8 +46,8 @@ fun Main(navController: NavController) {
|
||||
modifier = Modifier.padding(8.dp)
|
||||
)
|
||||
|
||||
ProductCard("MSI GeForce RTX 4090 VENTUS 3X OC", 210999, R.drawable.product1)
|
||||
ProductCard("Palit GeForce GTX 1660 SUPER", 25999, R.drawable.product2)
|
||||
ProductCard("MSI GeForce RTX 4090 VENTUS 3X OC", 210999, R.drawable.product1, navController)
|
||||
ProductCard("Palit GeForce GTX 1660 SUPER", 25999, R.drawable.product2, navController)
|
||||
}
|
||||
}
|
||||
|
||||
@ -55,6 +55,5 @@ fun Main(navController: NavController) {
|
||||
@Composable
|
||||
fun MainPreview() {
|
||||
val navController = rememberNavController()
|
||||
|
||||
Main(navController = navController)
|
||||
}
|
@ -18,17 +18,17 @@ fun Processors (navController: NavController) {
|
||||
LazyColumn {
|
||||
item {
|
||||
Text(
|
||||
text = "Видеокарты",
|
||||
text = "Процессоры",
|
||||
fontSize = 28.sp,
|
||||
color = Color.Black,
|
||||
modifier = Modifier.padding(8.dp)
|
||||
)
|
||||
}
|
||||
item {
|
||||
ProductCard("Intel Celeron G5905 OEM", 4099, R.drawable.product3)
|
||||
ProductCard("Intel Celeron G5905 OEM", 4099, R.drawable.product3, navController)
|
||||
}
|
||||
item {
|
||||
ProductCard("AMD Ryzen 5 4500 BOX", 9799, R.drawable.product4)
|
||||
ProductCard("AMD Ryzen 5 4500 BOX", 9799, R.drawable.product4, navController)
|
||||
}
|
||||
|
||||
item {
|
||||
|
@ -26,10 +26,10 @@ fun Videocards (navController: NavController) {
|
||||
)
|
||||
}
|
||||
item {
|
||||
ProductCard("MSI GeForce RTX 4090 VENTUS 3X OC", 210999, R.drawable.product1)
|
||||
//ProductCard("MSI GeForce RTX 4090 VENTUS 3X OC", 210999, R.drawable.product1)
|
||||
}
|
||||
item {
|
||||
ProductCard("Palit GeForce GTX 1660 SUPER", 25999, R.drawable.product2)
|
||||
//ProductCard("Palit GeForce GTX 1660 SUPER", 25999, R.drawable.product2)
|
||||
}
|
||||
|
||||
item {
|
||||
@ -51,5 +51,5 @@ fun Videocards (navController: NavController) {
|
||||
@Composable
|
||||
fun Videocards() {
|
||||
val navController = rememberNavController()
|
||||
Videocards(navController = navController)
|
||||
//Videocards(navController = navController)
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
import androidx.compose.foundation.BorderStroke
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.shape.CircleShape
|
||||
import androidx.compose.foundation.shape.CornerSize
|
||||
import androidx.compose.foundation.shape.CutCornerShape
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.material3.Button
|
||||
import androidx.compose.material3.ButtonDefaults
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.RectangleShape
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import androidx.navigation.NavController
|
||||
|
||||
@Composable
|
||||
fun ButtonNice(text: String, color: Color, route: String, navController: NavController){
|
||||
Button(
|
||||
onClick = { navController.navigate(route) },
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
border = BorderStroke(1.dp, Color.Black),
|
||||
shape = RoundedCornerShape(corner = CornerSize(5.dp)),
|
||||
colors = ButtonDefaults.buttonColors(
|
||||
containerColor = color,
|
||||
)
|
||||
) {
|
||||
Text(text, fontSize = 20.sp, color = Color.Black)
|
||||
}
|
||||
}
|
@ -23,6 +23,7 @@ import android.graphics.Bitmap
|
||||
import androidx.compose.foundation.Image
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.navigation.NavController
|
||||
import com.example.myapplication.R
|
||||
|
||||
@Composable
|
||||
fun CatalogItem(text: String, navController: NavController, route: String) {
|
||||
@ -45,4 +46,3 @@ fun CatalogItem(text: String, navController: NavController, route: String) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -27,11 +27,12 @@ import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import androidx.navigation.NavController
|
||||
import androidx.navigation.compose.rememberNavController
|
||||
import com.example.myapplication.R
|
||||
|
||||
@Composable
|
||||
fun ProductCard(name: String, price: Int, @DrawableRes imgId: Int) {
|
||||
|
||||
fun ProductCard(name: String, price: Int, @DrawableRes imgId: Int, navController: NavController) {
|
||||
Column (modifier = Modifier.padding(top = 20.dp, start = 10.dp, end=10.dp)) {
|
||||
Row {
|
||||
Image(
|
||||
@ -44,26 +45,16 @@ fun ProductCard(name: String, price: Int, @DrawableRes imgId: Int) {
|
||||
Column (modifier = Modifier.padding(start = 15.dp, end = 15.dp)){
|
||||
Text(text = name, fontSize = 24.sp, color = Color.Black)
|
||||
Text(text = price.toString() + " ₽", fontSize = 16.sp, color = Color.Black)
|
||||
ButtonNice(text = "Инфо" , color = myColor2, route = "", navController = navController)
|
||||
}
|
||||
}
|
||||
Button(
|
||||
onClick = { },
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
border = BorderStroke(1.dp, Color.Black),
|
||||
colors = ButtonDefaults.buttonColors(
|
||||
containerColor = Color.White,
|
||||
)
|
||||
) {
|
||||
TextNice("Добавить в корзину")
|
||||
}
|
||||
|
||||
|
||||
ButtonNice(text ="Добавить в корзину" , color = myColor1, route = "", navController = navController)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Preview(showBackground = true)
|
||||
@Composable
|
||||
fun ProductCardPreview() {
|
||||
ProductCard("MSI GeForce RTX 4090 VENTUS 3X OC" ,15000, R.drawable.product1)
|
||||
val navController = rememberNavController()
|
||||
ProductCard("MSI GeForce RTX 4090 VENTUS 3X OC" ,15000, R.drawable.product1, navController)
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
import androidx.annotation.DrawableRes
|
||||
import androidx.compose.foundation.BorderStroke
|
||||
import androidx.compose.foundation.Image
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.aspectRatio
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.material3.Button
|
||||
import androidx.compose.material3.ButtonDefaults
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
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
|
||||
|
||||
@Composable
|
||||
fun ProductCardInCart(name: String, price: Int, @DrawableRes imgId: Int) {
|
||||
|
||||
Column (modifier = Modifier.padding(top = 20.dp, start = 10.dp, end=10.dp)) {
|
||||
Row {
|
||||
Image(
|
||||
painter = painterResource(id = imgId),
|
||||
contentDescription = null,
|
||||
modifier = Modifier
|
||||
.size(200.dp)
|
||||
.aspectRatio(1f) // Устанавливаем соотношение сторон 1:1 (квадрат)
|
||||
)
|
||||
Column (modifier = Modifier.padding(start = 15.dp, end = 15.dp)){
|
||||
Text(text = name, fontSize = 24.sp, color = Color.Black)
|
||||
Text(text = price.toString() + " ₽", fontSize = 16.sp, color = Color.Black)
|
||||
}
|
||||
}
|
||||
Button(
|
||||
onClick = { },
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
border = BorderStroke(1.dp, Color.Black),
|
||||
colors = ButtonDefaults.buttonColors(
|
||||
containerColor = Color.White,
|
||||
)
|
||||
) {
|
||||
TextNice("Убрать из корзины")
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,58 @@
|
||||
import androidx.annotation.DrawableRes
|
||||
import androidx.compose.foundation.Image
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.aspectRatio
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.navigation.NavController
|
||||
import androidx.navigation.compose.rememberNavController
|
||||
import com.example.myapplication.R
|
||||
|
||||
@Composable
|
||||
fun ProductPage(name: String,info: String, price: Int, @DrawableRes imgId: Int, navController: NavController){
|
||||
LazyColumn (modifier = Modifier.fillMaxSize().padding(10.dp)) {
|
||||
|
||||
item{
|
||||
TextNice(name)
|
||||
}
|
||||
item {
|
||||
Image(
|
||||
painter = painterResource(id = imgId),
|
||||
contentDescription = null,
|
||||
modifier = Modifier
|
||||
.size(400.dp)
|
||||
.aspectRatio(1f) // Устанавливаем соотношение сторон 1:1 (квадрат)
|
||||
)}
|
||||
|
||||
item{TextNice("Характеристики: ")}
|
||||
item{Text(info)}
|
||||
item{ButtonNice("Добавить в корзину", Color(185, 20, 255, 255), "",navController )}
|
||||
}
|
||||
}
|
||||
|
||||
@Preview
|
||||
@Composable
|
||||
fun ProductPagePreview(){
|
||||
val navController = rememberNavController()
|
||||
ProductPage("MSI GeForce RTX 4090 VENTUS 3X OC" ,"Общая информация: Дата выхода на рынок 2022 г.\n" +
|
||||
"Основные характеристики: Подбор в один клик с трассировкой лучей, для игр в 4K, для рендеринга, профессиональная\n" +
|
||||
"Интерфейс: PCI Express x16 4.0\n" +
|
||||
"Производитель графического процессора: NVIDIA\n" +
|
||||
"Микроархитектура: NVIDIA Ada Lovelace\n" +
|
||||
"Кодовое имя чипа: AD102\n" +
|
||||
"Графический процессор: GeForce RTX 4090\n" +
|
||||
"«Разогнанная» версия: Нет\n" +
|
||||
"Трассировка лучей: Да\n" +
|
||||
"Защита от майнинга (LHR): Нет\n" +
|
||||
"Внешняя видеокарта: Нет",15000, R.drawable.product1, navController)
|
||||
}
|
@ -54,7 +54,8 @@ fun Navbar() {
|
||||
}
|
||||
}
|
||||
}
|
||||
) {innerPaddings ->
|
||||
)
|
||||
{ innerPaddings ->
|
||||
NavHost(
|
||||
navController = navController,
|
||||
startDestination = "authorization",
|
||||
@ -66,6 +67,7 @@ fun Navbar() {
|
||||
composable("registration") { Registration(navController) }
|
||||
composable("catalog") { Catalog(navController) }
|
||||
composable("videocards") { Videocards(navController) }
|
||||
composable("cart") { Cart(navController)}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,4 @@
|
||||
import androidx.compose.ui.graphics.Color
|
||||
|
||||
val myColor1 = Color(68, 228, 208)
|
||||
val myColor2 = Color(233, 30, 165, 255)
|
Loading…
Reference in New Issue
Block a user