*[<Null safety>](https://dart.dev/null-safety)*
dynamic viewport
Returns the viewport rect of the child view in parent's coordinates.
This only works if there is one and only one widget that has the Key
set to GlobalObjectKey
using this constroller's instance. FuchsiaView
set's its key
to the controller instance passed to it.
Returns null
if the child view has not been rendered.
Note: this viewport is not used by the injector, not needed there.
Implementation
Rect? get viewport {
final key = GlobalObjectKey(this);
RenderBox? box = key.currentContext?.findRenderObject() as RenderBox?;
if (box?.hasSize == true) {
final offset = box!.localToGlobal(Offset.zero);
return offset & box.size;
}
return null;
}