skydoves / landscapist

🌻 A pluggable, highly optimized Jetpack Compose and Kotlin Multiplatform image loading library that fetches and displays network images with Glide, Coil, and Fresco.

Home Page:https://skydoves.github.io/landscapist/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

java.lang.IllegalArgumentException: maxWidth(836) must be >= than minWidth(3024)

kevinroy-lo opened this issue · comments

Please complete the following information:

  • Library Version [e.g. v1.0.0]
  • Affected Device(s) [All devices]

Describe the Bug:
`FlowRow(
modifier = modifier
.padding(all = 12.dp)
.fillMaxWidth(),
maxItemsInEachRow = rowSize,
horizontalArrangement = Arrangement.spacedBy(2.dp),
){
// ...

Box(
modifier = Modifier
.padding(top = 2.dp)
.clip(itemCorner)
.border(0.5.dp, Color(0x33000000), itemCorner)
.background(Color(0x33FFFFFF), itemCorner)
.aspectRatio(1f)
.weight(1f)
){

   GlideImage(
                                    imageModel = item.url,
                                    contentDescription = "",
                                    contentScale = ContentScale.FillBounds,
                                    modifier = Modifier.fillMaxSize()
                                )

}
}

`
Add a clear description about the problem.

Crashed when used in Flow with weight set to 1.
Turn to normal when i change GlideImage to use Image .

java.lang.IllegalArgumentException: maxWidth(836) must be >= than minWidth(3024) at androidx.compose.ui.unit.ConstraintsKt.Constraints(Constraints.kt:424) at androidx.compose.foundation.layout.OrientationIndependentConstraints.toBoxConstraints-OenEA2s(RowColumnImpl.kt:339) at androidx.compose.foundation.layout.FlowLayoutKt.breakDownItems(FlowLayout.kt:635) at androidx.compose.foundation.layout.FlowLayoutKt$flowMeasurePolicy$1.measure-3p2s80s(FlowLayout.kt:235) at androidx.compose.ui.node.InnerNodeCoordinator.measure-BRTryo0(InnerNodeCoordinator.kt:103) at androidx.compose.foundation.layout.FillModifier.measure-3p2s80s(Size.kt:658) at androidx.compose.ui.node.BackwardsCompatNode.measure-3p2s80s(BackwardsCompatNode.kt:323) at androidx.compose.ui.node.LayoutModifierNodeCoordinator.measure-BRTryo0(LayoutModifierNodeCoordinator.kt:155) at androidx.compose.foundation.layout.PaddingModifier.measure-3p2s80s(Padding.kt:364) at androidx.compose.ui.node.BackwardsCompatNode.measure-3p2s80s(BackwardsCompatNode.kt:323) at androidx.compose.ui.node.LayoutModifierNodeCoordinator.measure-BRTryo0(LayoutModifierNodeCoordinator.kt:155) at androidx.compose.foundation.layout.FillModifier.measure-3p2s80s(Size.kt:658) at androidx.compose.ui.node.BackwardsCompatNode.measure-3p2s80s(BackwardsCompatNode.kt:323) at androidx.compose.ui.node.LayoutModifierNodeCoordinator.measure-BRTryo0(LayoutModifierNodeCoordinator.kt:155) at androidx.compose.ui.node.LayoutNodeLayoutDelegate$performMeasure$2.invoke(LayoutNodeLayoutDelegate.kt:1090)

Expected Behavior:
Diaplay as normal .

A clear description of what you expected to happen.

Hey @kevinroy-lo, would you provide the full context of your usage? Thanks!

Sorry, my mistake. The issue I mentioned earlier about the problem with using 'weight' in Compose within FlowRow is not caused by landscapist. Although the problem has been resolved, I still don't quite understand why it is necessary to set a width before using 'weight' in FlowRow, or else the previous issue may occur again.

Sorry, my mistake. The issue I mentioned earlier about the problem with using 'weight' in Compose within FlowRow is not caused by landscapist. Although the problem has been resolved, I still don't quite understand why it is necessary to set a width before using 'weight' in FlowRow, or else the previous issue may occur again.