Package for obtaining the widget position and size in the app

Getting Started

This package was created in order to obtained the position and the size of the widget in the app.

The position will begin in the app's top left corner, which may later be utilised in the Positioned widget as top left. You can't use any other GlobalKey inside the child of this Widget because the package relies on it. It will produce a duplicated key error.

A child and properties were required parameters for the widget. The properties function returns both the size and the location of the child widget. Please notice that the child widget will be wrapped in Wrap widget to retrieve the child widget's exact position without any expansion. As a result, it may interfere with certain of your parent widgets, such as the Column or Row widget.


{@tool snippet Sample--template=stateful_widget_material}

  Widget build(BuildContext context) {
    return Scaffold(
      body: Container(
        child: Column(
          mainAxisSize: MainAxisSize.max,
          children: [
              location: (properties) => print(
                  'This text location is at (${properties.position.dx},${properties.position.dy})\nThis widget has a width: ${properties.size.width}, height:${properties.size.height}'),
              child: Text(
                'Hello World',