Откатил к старой версий, без пагинаций
This commit is contained in:
parent
ee980fe775
commit
4226f90712
@ -50,67 +50,17 @@ fun ScreenListProduct(
|
|||||||
navHostController: NavHostController
|
navHostController: NavHostController
|
||||||
) {
|
) {
|
||||||
val bicycles by bicycleViewModel.bicycles.collectAsState()
|
val bicycles by bicycleViewModel.bicycles.collectAsState()
|
||||||
var currentIndex by remember { mutableStateOf(0) }
|
|
||||||
|
|
||||||
LaunchedEffect(Unit) {
|
LaunchedEffect(Unit) {
|
||||||
bicycleViewModel.fetchBicycles()
|
bicycleViewModel.fetchBicycles()
|
||||||
}
|
}
|
||||||
|
|
||||||
val paginatedBicycles = bicycles.chunked(3)
|
|
||||||
|
|
||||||
|
|
||||||
Column(
|
Column(
|
||||||
modifier = Modifier.fillMaxHeight().padding(bottom = 65.dp)
|
modifier = Modifier.fillMaxHeight().padding(bottom = 65.dp)
|
||||||
) {
|
) {
|
||||||
Column(
|
|
||||||
horizontalAlignment = Alignment.CenterHorizontally,
|
|
||||||
modifier = Modifier.fillMaxWidth().padding(top = 8.dp)
|
|
||||||
) {
|
|
||||||
Button(
|
|
||||||
colors = ButtonDefaults.buttonColors(backgroundColor = LightBluePolitech),
|
|
||||||
modifier = Modifier
|
|
||||||
.fillMaxWidth()
|
|
||||||
.padding(9.dp),
|
|
||||||
onClick = {
|
|
||||||
if (currentIndex > 0) {
|
|
||||||
currentIndex--
|
|
||||||
}
|
|
||||||
},
|
|
||||||
shape = RoundedCornerShape(15.dp),
|
|
||||||
enabled = currentIndex > 0
|
|
||||||
) {
|
|
||||||
Text(text = "Предыдущая страничка",
|
|
||||||
color = Color.White,
|
|
||||||
fontSize = 10.sp,
|
|
||||||
textAlign = TextAlign.Center)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
Spacer(modifier = Modifier.width(8.dp))
|
|
||||||
|
|
||||||
Button(
|
|
||||||
colors = ButtonDefaults.buttonColors(backgroundColor = LightBluePolitech),
|
|
||||||
modifier = Modifier
|
|
||||||
.fillMaxWidth()
|
|
||||||
.padding(9.dp),
|
|
||||||
onClick = {
|
|
||||||
if (currentIndex < paginatedBicycles.size - 1) {
|
|
||||||
currentIndex++
|
|
||||||
}
|
|
||||||
},
|
|
||||||
shape = RoundedCornerShape(15.dp),
|
|
||||||
enabled = currentIndex < paginatedBicycles.size - 1
|
|
||||||
) {
|
|
||||||
Text(text = "Следущая страничка",
|
|
||||||
color = Color.White,
|
|
||||||
fontSize = 10.sp,
|
|
||||||
textAlign = TextAlign.Center)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
FormNewProduct(bicycleViewModel, navHostController)
|
FormNewProduct(bicycleViewModel, navHostController)
|
||||||
LazyColumn {
|
LazyColumn {
|
||||||
paginatedBicycles.getOrNull(currentIndex)?.let { paginatedList ->
|
itemsIndexed(bicycles) { index, item ->
|
||||||
itemsIndexed(paginatedList) { _, item ->
|
|
||||||
ListProduct(
|
ListProduct(
|
||||||
item = item,
|
item = item,
|
||||||
bicycleViewModel = bicycleViewModel,
|
bicycleViewModel = bicycleViewModel,
|
||||||
@ -121,5 +71,3 @@ fun ScreenListProduct(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user