boxy
boxy copied to clipboard
Finding child Offeset
I would like to be able to find Global Offset of a child of Widget nested down below in Widget.
So let's say I have following Widget tree:
W0 |--W01 |--W02 |--W03 W1 |--W11 |--W12 |--W13
I would like to layout W0 and W1, find Offset of W02 and W12 and inflate with widget which is positioned between W02 and W12.
What's the best way to do it?
I believe Boxy took me 1 step closer to achieving that but iterating over children to find their Offset seem problematic, approach I've taken is with
RenderBox rb = element.findRenderObject() as RenderBox;
connectorOffset = rb.localToGlobal(Offset.zero);
...but I'm told I should not read Offset this way by framework.
Its not possible to read the offset of descendants because there is no way to guarantee that a child changing size will re-layout its grandparent.
Do you have a visual example of the layout you are trying to create?
Would like to recreate Blender's Node Editor
but with each Node starting as Scaffold.
Is the end goal to draw that line between them? You can do that entirely in a painter, it's generally safe to access RenderObjects during the paint phase and the framework shouldn't stop you.
...and so I did, now would like to draw those lines between Widgets, children to their parents. See those dots from screenshot, they would connect onto each other. I would need to find their Offset as their layout by the node Widget...