I know how to get the X,Y coordinates of a button/or component, but I want to know every corner offset or at least the right bottom offset. For example I'm getting the left top coordiantes from:
Modifier.onGloballyPositioned{
it.positionInRoot().x
it.positionInRoot().y
}
Is there a way to know bottom right coordinates so I can calculate the difference offset inside the component?
Edit: Possible solution -> use spacer next to the component: Let's imagine that we want to get the right bottom of a button.
Row(
horizontalArrangement = Arrangement.Center,
modifier = Modifier
.fillMaxWidth()
) {
Button(
modifier = Modifier
.onGloballyPositioned {
it.positionInRoot().x
it.positionInRoot().y
}
) {...}
Row(modifier =Modifier.fillMaxHeight(),verticalAlignment = Alignment.Bottom) {
Spacer(
Modifier
.height(0.dp)
.width(0.dp)
.onGloballyPositioned {
it.positionInRoot().x
it.positionInRoot().y
}
)
}
}