isVisible property

bool isVisible

Whether or not the child is actually visible within the viewport.

For example, if a child is contained within the RenderTwoDimensionalViewport.cacheExtent and out of view.

This is used during RenderTwoDimensionalViewport.paint in order to skip painting children that cannot be seen.

Implementation

bool get isVisible {
  assert(() {
    if (_paintExtent == null) {
      throw FlutterError.fromParts(<DiagnosticsNode>[
        ErrorSummary('The paint extent of the child has not been determined yet.'),
        ErrorDescription(
          'The paint extent, and therefore the visibility, of a child of a '
          'RenderTwoDimensionalViewport is computed after '
          'RenderTwoDimensionalViewport.layoutChildSequence.'
        ),
      ]);
    }
    return true;
  }());
  return _paintExtent != Size.zero || _paintExtent!.height != 0.0 || _paintExtent!.width != 0.0;
}