myanmarking
01/04/2023, 1:33 PMmyanmarking
01/04/2023, 1:33 PMfun Modifier.visibility(visible: Boolean) = this.composed {
layout { measurable, constraints ->
val placeable = measurable.measure(constraints)
layout(placeable.width, placeable.height) {
if (visible) placeable.place(0, 0)
}
}
}
myanmarking
01/04/2023, 1:34 PMZach Klippenstein (he/him) [MOD]
01/04/2023, 9:34 PMcomposed
there, it looks unnecessarymyanmarking
01/04/2023, 9:37 PMZach Klippenstein (he/him) [MOD]
01/04/2023, 9:39 PMvisible
over time and not seeing the layout modifier capture the new value?myanmarking
01/04/2023, 9:40 PMmyanmarking
01/04/2023, 10:18 PMmyanmarking
01/04/2023, 10:18 PMfun Modifier.visibility(visible: Boolean) = this.layout { measurable, constraints ->
val placeable = measurable.measure(constraints)
if (visible) {
layout(placeable.width, placeable.height) {
placeable.place(0, 0)
}
} else {
layout(0, 0) {}
}
}
myanmarking
01/04/2023, 10:18 PMmyanmarking
01/04/2023, 10:18 PMZach Klippenstein (he/him) [MOD]
01/05/2023, 12:21 AMLucas Kivi
01/10/2023, 7:00 PMfun Modifier.measureWithoutPlacing(isVisible: Boolean): Modifier =
if (isVisible.not()) {
layout { measurable, constraints ->
val placeable = measurable.measure(constraints)
layout(placeable.measuredWidth, placeable.measuredHeight) {}
}
} else {
this
}