childTransform function
Maps local child coordinates to the parent, rotating around the layout center. Used by painting, pointer targeting, coordinate conversion and focus bounds.
Implementation
Matrix4 childTransform(
Offset position,
Size size,
double rotation, {
double scale = 1,
}) {
final transform = Matrix4.identity()
..translateByDouble(position.dx, position.dy, 0, 1)
..scaleByDouble(scale, scale, 1, 1);
if (rotation != 0) {
final center = size.center(Offset.zero);
transform
..translateByDouble(center.dx, center.dy, 0, 1)
..rotateZ(rotation)
..translateByDouble(-center.dx, -center.dy, 0, 1);
}
return transform;
}