Fudge
07/20/2020, 2:58 PMAdam Powell
07/20/2020, 3:10 PMFudge
07/20/2020, 3:10 PMAdam Powell
07/20/2020, 3:12 PMModifier.layout {}
API for defining these quickly without explicitly declaring a LayoutModifier class but it should be coming soonFudge
07/20/2020, 3:14 PMBox(Modifier.width(20.dp)) {
Text("Foo Bar")
}
Are you saying I can achieve this by using some custom layout with Layout()
?Adam Powell
07/20/2020, 3:14 PMFudge
07/20/2020, 3:17 PMokarm
07/20/2020, 3:20 PMFudge
07/20/2020, 3:20 PMokarm
07/20/2020, 3:21 PMAdam Powell
07/20/2020, 3:28 PMFudge
07/20/2020, 3:31 PMmeasure
method decides the constraints that are given to the children? What decides what constraints are given to the parent?private data class CutModifier(
private val maxWidth: Dp
) : LayoutModifier {
override fun MeasureScope.measure(
measurable: Measurable,
constraints: Constraints,
layoutDirection: LayoutDirection
): MeasureScope.MeasureResult {
val placeable = measurable.measure(constraints)
return layout(maxWidth.toIntPx(), placeable.height) {
placeable.place(0, 0)
}
}
}
Is this right? It seems like the modifier is not doing anythingAdam Powell
07/20/2020, 4:21 PM