Skip to content

Getting the size of a widget should have a simplified API #2321

@apwilson

Description

@apwilson

Currently to get the size of a widget you need to do this:

  Size get _size {
    assert(mounted);
    RenderBox box = context.findRenderObject();
    assert(box != null);
    assert(box.hasSize);
    return box.size;
  }

It'd be nice to have this as a built in api.

((I'm copying this code all over the place.))

Similarly getting the size of the widget via GlobalKey would be good too. Maybe something can be added to GlobalKey?

Metadata

Metadata

Assignees

Labels

c: new featureNothing broken; request for a new capabilityframeworkflutter/packages/flutter repository. See also f: labels.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions