Сделал что то типо нормально списка
This commit is contained in:
parent
d1ca80dc9c
commit
f151ccd599
@ -6,6 +6,7 @@ import androidx.compose.foundation.layout.Arrangement
|
|||||||
import androidx.compose.foundation.layout.Box
|
import androidx.compose.foundation.layout.Box
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
import androidx.compose.foundation.layout.Row
|
import androidx.compose.foundation.layout.Row
|
||||||
|
import androidx.compose.foundation.layout.fillMaxHeight
|
||||||
import androidx.compose.foundation.layout.fillMaxSize
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
import androidx.compose.foundation.layout.offset
|
import androidx.compose.foundation.layout.offset
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
@ -13,6 +14,8 @@ import androidx.compose.foundation.layout.requiredHeight
|
|||||||
import androidx.compose.foundation.layout.requiredSize
|
import androidx.compose.foundation.layout.requiredSize
|
||||||
import androidx.compose.foundation.layout.requiredWidth
|
import androidx.compose.foundation.layout.requiredWidth
|
||||||
import androidx.compose.foundation.layout.wrapContentHeight
|
import androidx.compose.foundation.layout.wrapContentHeight
|
||||||
|
import androidx.compose.foundation.lazy.LazyColumn
|
||||||
|
import androidx.compose.foundation.lazy.itemsIndexed
|
||||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||||
import androidx.compose.material.Text
|
import androidx.compose.material.Text
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
@ -29,6 +32,7 @@ import androidx.compose.ui.unit.dp
|
|||||||
import androidx.compose.ui.unit.em
|
import androidx.compose.ui.unit.em
|
||||||
import androidx.compose.ui.unit.sp
|
import androidx.compose.ui.unit.sp
|
||||||
import com.example.labwork.R
|
import com.example.labwork.R
|
||||||
|
import com.example.labwork.pages.ItemProduct
|
||||||
import com.example.labwork.pages.ListProduct
|
import com.example.labwork.pages.ListProduct
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
@ -54,13 +58,28 @@ fun ScreenProfile() {
|
|||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun ScreenListProduct() {
|
fun ScreenListProduct() {
|
||||||
Column {
|
LazyColumn(
|
||||||
ListProduct("Максим", "Тест")
|
modifier = Modifier.fillMaxHeight()
|
||||||
ListProduct("Максим", "Тест")
|
) {
|
||||||
ListProduct("Максим", "Тест")
|
itemsIndexed(
|
||||||
ListProduct("Максим", "Тест")
|
listOf(
|
||||||
ListProduct("Максим", "Тест")
|
ItemProduct(R.drawable.baseline_menu_book,"Золотая рыбка","Сказка"),
|
||||||
ListProduct("Максим", "Тест")
|
ItemProduct(R.drawable.baseline_menu_book,"Золотая рыбка","Сказка"),
|
||||||
|
ItemProduct(R.drawable.baseline_menu_book,"Золотая рыбка","Сказка"),
|
||||||
|
ItemProduct(R.drawable.baseline_menu_book,"Золотая рыбка","Сказка"),
|
||||||
|
ItemProduct(R.drawable.baseline_menu_book,"Золотая рыбка","Сказка"),
|
||||||
|
ItemProduct(R.drawable.baseline_menu_book,"Золотая рыбка","Сказка"),
|
||||||
|
ItemProduct(R.drawable.baseline_menu_book,"Золотая рыбка","Сказка"),
|
||||||
|
ItemProduct(R.drawable.baseline_menu_book,"Золотая рыбка","Сказка"),
|
||||||
|
ItemProduct(R.drawable.baseline_menu_book,"Золотая рыбка","Сказка"),
|
||||||
|
ItemProduct(R.drawable.baseline_menu_book,"Золотая рыбка","Сказка"),
|
||||||
|
ItemProduct(R.drawable.baseline_menu_book,"Золотая рыбка","Сказка")
|
||||||
|
)
|
||||||
|
)
|
||||||
|
{
|
||||||
|
_, item ->
|
||||||
|
ListProduct(item = item)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,7 @@
|
|||||||
|
package com.example.labwork.pages
|
||||||
|
|
||||||
|
data class ItemProduct(
|
||||||
|
val imageId: Int,
|
||||||
|
val name: String,
|
||||||
|
val about: String
|
||||||
|
)
|
@ -22,7 +22,7 @@ import androidx.compose.ui.unit.dp
|
|||||||
import com.example.labwork.R
|
import com.example.labwork.R
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun ListProduct(name: String, about: String) {
|
fun ListProduct(item: ItemProduct) {
|
||||||
Card(modifier = Modifier
|
Card(modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.padding(10.dp),
|
.padding(10.dp),
|
||||||
@ -31,7 +31,7 @@ fun ListProduct(name: String, about: String) {
|
|||||||
) {
|
) {
|
||||||
Box {
|
Box {
|
||||||
Row(verticalAlignment = Alignment.CenterVertically) {
|
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||||
Image(painter = painterResource(id = R.drawable.baseline_menu_book),
|
Image(painter = painterResource(id = item.imageId),
|
||||||
contentDescription = "book",
|
contentDescription = "book",
|
||||||
contentScale = ContentScale.Crop,
|
contentScale = ContentScale.Crop,
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
@ -40,8 +40,8 @@ fun ListProduct(name: String, about: String) {
|
|||||||
.shadow(2.dp)
|
.shadow(2.dp)
|
||||||
)
|
)
|
||||||
Column {
|
Column {
|
||||||
Text(text = name)
|
Text(text = item.name)
|
||||||
Text(text = about)
|
Text(text = item.about)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user