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 ]) {
  final Rect shiftedRect = layerOffset == Offset.zero ? rect : rect.shift(layerOffset);
  builder.addPlatformView(
    viewId,
    offset: shiftedRect.topLeft,
    width: shiftedRect.width,
    height: shiftedRect.height,
  );
  return null;
}