SpherePainter constructor

SpherePainter({
  1. required SphereImage sphereImage,
  2. required SphereStyle style,
})

Creates a SpherePainter with the specified sphereImage and style.

The sphereImage represents the image of the sphere to be drawn, along with its position and size. The style defines the appearance of the sphere, including shadow and gradient overlay settings.

Example usage:

final painter = SpherePainter(
  sphereImage: SphereImage(
    image: myImage,
    offset: Offset(100, 100),
    radius: 50,
    origin: Offset(25, 25),
  ),
  style: SphereStyle(
    showShadow: true,
    shadowColor: Colors.blue,
    shadowBlurStyle: BlurStyle.normal,
    shadowBlurSigma: 5.0,
    showGradientOverlay: true,
    gradientOverlay: LinearGradient(
      colors: [Colors.red, Colors.yellow],
      begin: Alignment.topLeft,
      end: Alignment.bottomRight,
    ),
  ),
);

final customPaint = CustomPaint(
  painter: painter,
  size: Size(200, 200),
);

Implementation

SpherePainter({required this.sphereImage, required this.style});