-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Description
Most widgets that modify the rendering of their children, or rather the RenderObject associated with those widgets, have code that detects if the children need compositing. If the children need compositing then they inject themselves into the tree as a layer. If the children do not need compositing then they simply issue rendering commands (usually along with a save() or saveLayer()) to set the rendering modification into the current picture/display list.
See the way that the pushTransform method tests compositing and changes the way it applies itself to rendering the tree:
| TransformLayer? pushTransform(bool needsCompositing, Offset offset, Matrix4 transform, PaintingContextCallback painter, { TransformLayer? oldLayer }) { |
OpacityLayer does not have the same tests and always adds a layer, it could simply emit a saveLayer with a Paint object that has the opacity in it if the children don't need compositing.