Roshan
Roshan

Reputation: 519

AndroidFragment composables with wieghts inside FlowRow changes width erratically

I'm trying to use the AndroidFragment Composable as items inside FlowRow but when weights are applied to the items, each item's width changes erratically. No issues when fixed width is given. Does anyone know the reason or a fix for this?

FlowRow(
    modifier = Modifier
         .fillMaxWidth()
         .padding(horizontal = 16.dp),
    horizontalArrangement = Arrangement.spacedBy(16.dp),
    verticalArrangement = Arrangement.spacedBy(16.dp),
    maxItemsInEachRow = 2,
    ) {
        fragmentClasses.forEach { fragmentClass ->
            AndroidFragment(
                clazz = fragmentClass,
                modifier = Modifier
                    .weight(0.5f)
                    .fillMaxRowHeight()
                    .heightIn(136.dp),
            )
        }
}

Upvotes: 0

Views: 26

Answers (0)

Related Questions