setData method

void setData({
  1. required TextureRegion textureRegion,
  2. double rotation = 0.0,
  3. double scale = 1.0,
  4. int? color,
  5. double opacity = 1.0,
})

Implementation

void setData(
    {required TextureRegion textureRegion,
    double rotation = 0.0,
    double scale = 1.0,
    int? color,
    double opacity = 1.0}) {
  this.textureRegion = textureRegion;
  setTransformData(
      rotation: rotation,
      scale: scale,
      anchorX: textureRegion.anchorX,
      anchorY: textureRegion.anchorY);
  this.color = color ?? ((opacity == 1.0) ? Colors.white : Colors.whiteWithOpacity(opacity));
}