MaxUt
08/02/2021, 10:14 AMMaxUt
08/02/2021, 10:16 AMMaxUt
08/02/2021, 10:16 AMval text = "This is a test"
Row(modifier = Modifier
.border(2.dp, Color.Gray, RectangleShape)
.removeRotationSpace()
.rotate(-90f)
) {
Column(horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.Center) {
Text(text = text, color = OmegaColors.TextColor)
Box(
modifier = Modifier
.clip(CircleShape)
.size(5.dp)
.background(color = OmegaColors.BrandColor)
.offset()
)
}
Column(horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.Center) {
Text(text = text, color = OmegaColors.TextColor)
Box(
modifier = Modifier
.clip(CircleShape)
.size(5.dp)
.background(color = OmegaColors.BrandColor)
.offset()
)
}
}
fun Modifier.removeRotationSpace() = layout { measurable, constraints ->
val placeable = measurable.measure(constraints)
layout(placeable.height, placeable.width) {
placeable.place(0, 0)
}
}
Zach Klippenstein (he/him) [MOD]
08/02/2021, 1:39 PMMaxUt
08/03/2021, 2:02 PMMaxUt
08/03/2021, 2:02 PMMaxUt
08/03/2021, 2:32 PMfun Modifier.removeRotationSpace(
) = layout { measurable, constraints ->
val placeable = measurable.measure(constraints)
val yPos = placeable.width / 2 - placeable.height / 2
val xPos = yPos * -1
layout(placeable.height, placeable.width) {
placeable.place(x = xPos, y = yPos)
}
}