getWidgetPosition function
Returns global top-left position for the widget associated with context.
Implementation
Offset? getWidgetPosition(BuildContext context) {
RenderBox? box = context.findRenderObject() as RenderBox?;
return box?.localToGlobal(Offset.zero);
}