Fix: dynamically position title/content input fields below image grid based on layout type

This commit is contained in:
2026-03-06 23:10:08 +08:00
parent d0048c1d1c
commit df063dc38e
71 changed files with 83 additions and 82 deletions

View File

@@ -1,4 +1,4 @@
#Fri Mar 06 23:02:01 CST 2026
#Fri Mar 06 23:09:36 CST 2026
path.4=14/classes.dex
path.3=12/classes.dex
path.2=10/classes.dex

View File

@@ -1 +1 @@
פ8מ)ת*ר'&ט%<EFBFBD>!רש#
פ8מ)ת*ר'&ט%<EFBFBD>!רש#<EFBFBD>#

View File

@@ -1 +1 @@
ëXè¾ú¹Ñ~Ì>Åô­ï`ý¿ÄJùÉïNÔî×úbå4å²×?Í#àÀ2èjÓ*ú3ð²À
ëXè¾ú¹Ñ~Ì>Åô­ï`ý¿ÄJùÉïNÔî×úbå4å²×?Í#àÀ2èjÓ*ú3ð²ÀÚëð2ã;

View File

@@ -258,87 +258,88 @@ fun MergeScreen(
}
}
// 图片网格
LazyVerticalGrid(
columns = GridCells.Fixed(layoutType.cols),
contentPadding = PaddingValues(16.dp),
// 图片网格 - 根据布局类型动态调整高度
Column(
modifier = Modifier
.weight(1f)
.fillMaxWidth(),
horizontalArrangement = Arrangement.spacedBy(8.dp),
verticalArrangement = Arrangement.spacedBy(8.dp)
.fillMaxWidth()
.padding(horizontal = 16.dp)
) {
itemsIndexed(images) { index, imageWithCache ->
Box(
modifier = Modifier
.aspectRatio(1f)
.clip(RoundedCornerShape(8.dp))
.background(Color.LightGray)
.clickable {
selectedImageIndex = index
imagePickerLauncher.launch("image/*")
// 图片网格
Column(
modifier = Modifier
.fillMaxWidth()
) {
// 动态创建行
for (row in 0 until layoutType.rows) {
Row(
modifier = Modifier.fillMaxWidth(),
horizontalArrangement = Arrangement.spacedBy(8.dp)
) {
for (col in 0 until layoutType.cols) {
val index = row * layoutType.cols + col
if (index < images.size || index < layoutType.maxImages) {
Box(
modifier = Modifier
.weight(1f)
.aspectRatio(1f)
.clip(RoundedCornerShape(8.dp))
.background(Color.LightGray)
.then(
if (index < images.size) {
Modifier.clickable {
selectedImageIndex = index
imagePickerLauncher.launch("image/*")
}
} else {
Modifier.clickable {
imagePickerLauncher.launch("image/*")
}
}
)
) {
if (index < images.size) {
val imageWithCache = images[index]
AsyncImage(
model = ImageRequest.Builder(context)
.data(imageWithCache.uri)
.crossfade(true)
.build(),
contentDescription = null,
contentScale = ContentScale.Crop,
modifier = Modifier.fillMaxSize()
)
// 删除按钮
IconButton(
onClick = { images.removeAt(index) },
modifier = Modifier
.align(Alignment.TopEnd)
.size(32.dp)
.background(Color.Black.copy(alpha = 0.5f), CircleShape)
) {
Icon(
Icons.Default.Close,
contentDescription = "删除",
tint = Color.White,
modifier = Modifier.size(16.dp)
)
}
} else {
Icon(
Icons.Default.Add,
contentDescription = "添加图片",
tint = Color.Gray,
modifier = Modifier.size(48.dp)
)
}
}
} else {
Spacer(modifier = Modifier.weight(1f))
}
}
) {
AsyncImage(
model = ImageRequest.Builder(context)
.data(imageWithCache.uri)
.crossfade(true)
.build(),
contentDescription = null,
contentScale = ContentScale.Crop,
modifier = Modifier.fillMaxSize()
)
// 删除按钮
IconButton(
onClick = { images.removeAt(index) },
modifier = Modifier
.align(Alignment.TopEnd)
.size(32.dp)
.background(Color.Black.copy(alpha = 0.5f), CircleShape)
) {
Icon(
Icons.Default.Close,
contentDescription = "删除",
tint = Color.White,
modifier = Modifier.size(16.dp)
)
}
// 替换图标
Icon(
Icons.Default.Refresh,
contentDescription = "替换",
tint = Color.White,
modifier = Modifier
.align(Alignment.BottomEnd)
.size(32.dp)
.padding(4.dp)
.background(Color.Black.copy(alpha = 0.5f), CircleShape)
.padding(4.dp)
)
}
}
// 添加图片按钮
if (images.size < layoutType.maxImages) {
item {
Box(
modifier = Modifier
.aspectRatio(1f)
.clip(RoundedCornerShape(8.dp))
.background(Color.LightGray.copy(alpha = 0.5f))
.clickable {
imagePickerLauncher.launch("image/*")
},
contentAlignment = Alignment.Center
) {
Icon(
Icons.Default.Add,
contentDescription = "添加图片",
tint = Color.Gray,
modifier = Modifier.size(48.dp)
)
if (row < layoutType.rows - 1) {
Spacer(modifier = Modifier.height(8.dp))
}
}
}