widgetCoordinatesFromGlobalKey function

WidgetCoordinates? widgetCoordinatesFromGlobalKey(
  1. GlobalKey<State<StatefulWidget>> globalKey
)

Implementation

WidgetCoordinates? widgetCoordinatesFromGlobalKey(GlobalKey globalKey) {
  final Rect? rect = globalKey.globalPaintBounds;
  if (rect == null) {
    return null;
  }

  return WidgetCoordinates(
    rect.left.ratioToInt,
    rect.top.ratioToInt,
    rect.right.ratioToInt,
    rect.bottom.ratioToInt,
  );
}