addToScene method

  1. @override
void addToScene(
  1. SceneBuilder builder
)
override

Override this method to upload this layer to the engine.

Implementation

@override
void addToScene(ui.SceneBuilder builder) {
  assert(showWhenUnlinked != null);
  if (link.leader == null && !showWhenUnlinked!) {
    _lastTransform = null;
    _lastOffset = null;
    _inverseDirty = true;
    engineLayer = null;
    return;
  }
  _establishTransform();
  if (_lastTransform != null) {
    _lastOffset = unlinkedOffset;
    engineLayer = builder.pushTransform(
      _lastTransform!.storage,
      oldLayer: _engineLayer as ui.TransformEngineLayer?,
    );
    addChildrenToScene(builder);
    builder.pop();
  } else {
    _lastOffset = null;
    final Matrix4 matrix = Matrix4.translationValues(unlinkedOffset!.dx, unlinkedOffset!.dy, .0);
    engineLayer = builder.pushTransform(
      matrix.storage,
      oldLayer: _engineLayer as ui.TransformEngineLayer?,
    );
    addChildrenToScene(builder);
    builder.pop();
  }
  _inverseDirty = true;
}