addToScene method

  1. @override
EngineLayer addToScene (SceneBuilder builder, [ Offset layerOffset = Offset.zero ])
override

Override this method to upload this layer to the engine.

Return the engine layer for retained rendering. When there's no corresponding engine layer, null is returned.

Implementation

@override
ui.EngineLayer addToScene(ui.SceneBuilder builder, [Offset layerOffset = Offset.zero]) {
  _lastEffectiveTransform = transform;
  final Offset totalOffset = offset + layerOffset;
  if (totalOffset != Offset.zero) {
    _lastEffectiveTransform = Matrix4.translationValues(totalOffset.dx, totalOffset.dy, 0.0)
      ..multiply(_lastEffectiveTransform);
  }
  builder.pushTransform(_lastEffectiveTransform.storage);
  addChildrenToScene(builder);
  builder.pop();
  return null; // this does not return an engine layer yet.
}