A delegate for computing the layout of a render object with a single child.
When asked to layout, CustomSingleChildLayout first calls getSize with its incoming constraints to determine its size. It then calls getConstraintsForChild to determine the constraints to apply to the child. After the child completes its layout, RenderCustomSingleChildLayoutBox calls getPositionForChild to determine the child's position.
The shouldRelayout method is called when a new instance of the class is provided, to check if the new instance actually represents different information.
The most efficient way to trigger a relayout is to supply a relayout argument to the constructor of the SingleChildLayoutDelegate. The custom object will listen to this value and relayout whenever the animation ticks, avoiding both the build phase of the pipeline.
BoxConstraints constraints) → BoxConstraints
- The constraints for the child given the incoming constraints. [...]
Size size, Size childSize) → Offset
- The position where the child should be placed. [...]
BoxConstraints constraints) → Size
- The size of this object given the incoming constraints. [...]
SingleChildLayoutDelegate oldDelegate) → bool
- Called whenever a new instance of the custom layout delegate class is provided to the RenderCustomSingleChildLayoutBox object, or any time that a new CustomSingleChildLayout object is created with a new instance of the custom layout delegate class (which amounts to the same thing, because the latter is implemented in terms of the former). [...]
Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
) → String
Returns a string representation of this object.