DocumentScreen: in page list, max size is for both width and height

This commit is contained in:
Pierre-Yves Nicolas
2025-06-08 20:13:14 +02:00
parent 9c5f2bc481
commit d14de65d00

View File

@@ -185,18 +185,23 @@ private fun PageList(
.fillMaxWidth() .fillMaxWidth()
.padding(vertical = 4.dp) .padding(vertical = 4.dp)
.background(MaterialTheme.colorScheme.secondaryContainer), .background(MaterialTheme.colorScheme.secondaryContainer),
horizontalArrangement = Arrangement.spacedBy(8.dp) horizontalArrangement = Arrangement.spacedBy(8.dp),
verticalAlignment = Alignment.CenterVertically
) { ) {
itemsIndexed (pageIds) { index, id -> itemsIndexed (pageIds) { index, id ->
// TODO Use small images rather than big ones // TODO Use small images rather than big ones
val bitmap = imageLoader(id).asImageBitmap() val bitmap = imageLoader(id).asImageBitmap()
val isSelected = index == currentPageIndex.value val isSelected = index == currentPageIndex.value
val borderColor = if (isSelected) MaterialTheme.colorScheme.primary else Color.Transparent val borderColor = if (isSelected) MaterialTheme.colorScheme.primary else Color.Transparent
val modifier =
if (bitmap.height > bitmap.width)
Modifier.height(120.dp)
else
Modifier.width(120.dp)
Image( Image(
bitmap = bitmap, bitmap = bitmap,
contentDescription = null, contentDescription = null,
modifier = Modifier modifier = modifier
.height(120.dp)
.padding(4.dp) .padding(4.dp)
.border(2.dp, borderColor) .border(2.dp, borderColor)
.clickable { currentPageIndex.value = index } .clickable { currentPageIndex.value = index }