Откатил к старой версий, без пагинаций
This commit is contained in:
parent
ee980fe775
commit
4226f90712
@ -50,76 +50,24 @@ fun ScreenListProduct(
|
||||
navHostController: NavHostController
|
||||
) {
|
||||
val bicycles by bicycleViewModel.bicycles.collectAsState()
|
||||
var currentIndex by remember { mutableStateOf(0) }
|
||||
|
||||
LaunchedEffect(Unit) {
|
||||
bicycleViewModel.fetchBicycles()
|
||||
}
|
||||
|
||||
val paginatedBicycles = bicycles.chunked(3)
|
||||
|
||||
|
||||
Column(
|
||||
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)
|
||||
LazyColumn {
|
||||
paginatedBicycles.getOrNull(currentIndex)?.let { paginatedList ->
|
||||
itemsIndexed(paginatedList) { _, item ->
|
||||
ListProduct(
|
||||
item = item,
|
||||
bicycleViewModel = bicycleViewModel,
|
||||
navHostController = navHostController
|
||||
)
|
||||
}
|
||||
itemsIndexed(bicycles) { index, item ->
|
||||
ListProduct(
|
||||
item = item,
|
||||
bicycleViewModel = bicycleViewModel,
|
||||
navHostController = navHostController
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user