getChildPosition method
Offset?
getChildPosition({
- Offset offset = Offset.zero,
- MyRelativePosition relativePosition = MyRelativePosition.topLeft,
Returns the Offset of the child
widget.
Implementation
Offset? getChildPosition({
Offset offset = Offset.zero,
MyRelativePosition relativePosition = MyRelativePosition.topLeft,
}) {
final RenderBox? box = getRenderBox();
final Size? size = box?.size;
if (box != null && size != null) {
final double x = size.width * relativePosition.percentX;
final double y = size.height * relativePosition.percentY;
return box.localToGlobal(Offset(x, y)) + offset;
}
return null;
}