effectiveTransformMatrix property

  1. @override
Matrix4 get effectiveTransformMatrix
override

Implementation

@override
Matrix4 get effectiveTransformMatrix {
  // Make sure it is used after renderBoxModel been created.
  assert(renderBoxModel != null);
  RenderBoxModel boxModel = renderBoxModel!;
  final Matrix4 result = Matrix4.identity();
  result.translate(transformOffset.dx, transformOffset.dy);
  late Offset translation;
  if (transformAlignment != Alignment.topLeft) {
    // Use boxSize instead of size to avoid Flutter cannot access size beyond parent access warning
    translation = boxModel.hasSize ? transformAlignment.alongSize(boxModel.boxSize!) : Offset.zero;
    result.translate(translation.dx, translation.dy);
  }

  if (transformMatrix != null) {
    result.multiply(transformMatrix!);
  }

  if (transformAlignment != Alignment.topLeft) result.translate(-translation.dx, -translation.dy);

  result.translate(-transformOffset.dx, -transformOffset.dy);

  assert(result.storage.every((double component) => component.isFinite));
  return result;
}