originOf static method
Screen rect of the widget that owns context; pass it as origin so the iPad/macOS share popover points at your button. UShare.originOf(context)
Implementation
static Rect? originOf(BuildContext context) {
final RenderObject? box = context.findRenderObject();
if (box is! RenderBox || !box.hasSize) return null;
return box.localToGlobal(Offset.zero) & box.size;
}