comicAnchorFaceOf function
The box a menu opens from when anchored on root: the one marked face under root (a labelled field's box,
not its label), or root itself when there is none or more than one.
Implementation
RenderBox comicAnchorFaceOf(RenderBox root) {
final faces = <RenderBox>[];
void find(RenderObject at) {
if (at is _RenderAnchorFace) {
faces.add(at);
return;
}
at.visitChildren(find);
}
find(root);
return faces.length == 1 ? faces.single : root;
}