PaintStyle constructor

PaintStyle({
  1. Color? fillColor,
  2. Gradient? fillGradient,
  3. Shader? fillShader,
  4. Color? strokeColor,
  5. Gradient? strokeGradient,
  6. Shader? strokeShader,
  7. Rect? gradientBounds,
  8. BlendMode? blendMode,
  9. double? strokeWidth,
  10. StrokeCap? strokeCap,
  11. StrokeJoin? strokeJoin,
  12. double? strokeMiterLimit,
  13. double? elevation,
  14. Color? shadowColor,
  15. List<double>? dash,
  16. DashOffset? dashOffset,
})

Creates a paint style.

Implementation

PaintStyle({
  this.fillColor,
  this.fillGradient,
  this.fillShader,
  this.strokeColor,
  this.strokeGradient,
  this.strokeShader,
  this.gradientBounds,
  this.blendMode,
  this.strokeWidth,
  this.strokeCap,
  this.strokeJoin,
  this.strokeMiterLimit,
  this.elevation,
  Color? shadowColor,
  this.dash,
  this.dashOffset,
})  : assert(
          isSingle([fillColor, fillGradient, fillShader], allowNone: true)),
      assert(isSingle([strokeColor, strokeGradient, strokeShader],
          allowNone: true)),
      assert(strokeColor != null ||
          strokeGradient != null ||
          strokeShader != null ||
          (strokeWidth == null ||
              strokeCap == null ||
              strokeJoin == null ||
              strokeMiterLimit == null)),
      assert(elevation != null || shadowColor == null),
      assert(dash != null || dashOffset == null),
      shadowColor = elevation == null
          ? null
          : fillColor ?? (strokeColor ?? const Color(0xFF000000));