fix: prevent tall images from being clipped in chat bubbles
Use ContentScale.Fit instead of FillWidth and add heightIn(max=360.dp) constraint so the entire image is always visible. For very tall images (ratio < 0.75), prioritize height constraints to avoid oversized bubbles. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
0179eba2ed
commit
d18b7c8a24
1 changed files with 4 additions and 2 deletions
|
|
@ -4,6 +4,7 @@ import androidx.compose.foundation.layout.Box
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
import androidx.compose.foundation.layout.aspectRatio
|
import androidx.compose.foundation.layout.aspectRatio
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
|
import androidx.compose.foundation.layout.heightIn
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.foundation.layout.widthIn
|
import androidx.compose.foundation.layout.widthIn
|
||||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||||
|
|
@ -61,8 +62,9 @@ fun MessageBubble(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.padding(bottom = 8.dp)
|
.padding(bottom = 8.dp)
|
||||||
.aspectRatio(ratio),
|
.heightIn(max = 360.dp)
|
||||||
contentScale = ContentScale.FillWidth
|
.aspectRatio(ratio, matchHeightConstraintsFirst = ratio < 0.75f),
|
||||||
|
contentScale = ContentScale.Fit
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
if (message.content.isNotEmpty()) {
|
if (message.content.isNotEmpty()) {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue