Closed KwonDae closed 6 months ago
Hey @KwonDae, I believe you'll be able to resolve this issue by wrapping your GlideImage
with a Box
Composable, as demonstrated in the code below:
Box(modifier = Modifier.size(56.dp)) {
GlideImage(..)
}
Thanks @skydoves Should I use fixed size in parent composable of GlideImage?
FlowRow(
modifier = modifier.fillMaxWidth(),
maxItemsInEachRow = 2,
) {
items.forEach {
ImageItem(
item = it,
modifier = Modifier.weight(0.5f)
)
}
}
I use GlideImage within Modifier.weight
Hi @KwonDae, you actually don't need to use FlowRow
if you want to maintain the same width for each item as half the size. Instead, you can utilize LazyVerticalGrid
.
LazyVerticalGrid(
modifier = Modifier.fillMaxWidth(),
columns = GridCells.Fixed(2)
) {
Hi @skydoves, Thanks to you, I was able to solve the Issue.
I'm more curious to see how coil render image without that issue in FlowRow
. I find AsyncImage using SizeResolver with ConstraintSizeResolver.
Has it something to do with above issue?
GlideImage render content within BoxWithConstraintsScope, AsyncImage use Layout with ConstraintsSizeResolver?
Hey @KwonDae, Landscapist uses SizeResolver to request pre-computed image sizes before rendering. The reason for adopting BoxWithConstraints is to limit content sizes and support match-parent functionality. This is achieved by leveraging the properties of SubComposeLayout
, which delegates incoming parent constraints, making it easier to implement match-parent features.
On the other hand, Landscapist offers other image libraries, such as Glide and Fresco, but they don't yet provide features similar to SizeResolver
. Therefore, I need to find a better way to support all of them. This is important because BoxWithConstraints
incurs slightly higher overhead compared to a regular Box
.
Thank you for the answers. It was very helpful, I got a lot out of it :)
Hey, I have a case, where I have to support match_parent
behavior for a single image. Are there any other solutions to avoid setting specific size values? The error says to "consider replacing the parent of the component with a custom layout which controls the order in which children are measured, making intrinsic measurement not needed". Have you considered supporting this for the Glide version of the library?
Please complete the following information:
Describe the Bug:
I'm using as above structure. When I use
GlideImage
insideTabRow
, the following error occurs,It is said that it does not support intrinsic measurements behavior inside components such as
TabRow
usingSubcomposeLayout
.Is it possible that the contents of the
ImageLoad
are usingBoxWithConstraintsScope
internally in the process of calling theImageLoad
function inprivate fun GlideImage
?