addToScene method Null safety
- SceneBuilder builder
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
void addToScene(ui.SceneBuilder builder) {
assert(link != null);
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;
}