toPaint method

  1. @override
Paint toPaint()
override

Create the Paint object that corresponds to this shadow description.

The offset and spreadRadius are not represented in the Paint object. To honor those as well, the shape should be inflated by spreadRadius pixels in every direction and then translated by offset before being filled using this Paint.

Implementation

@override
Paint toPaint() {
  final Paint result = Paint()
    ..color = color
    ..maskFilter = MaskFilter.blur(blurStyle, blurSigma);
  assert(() {
    if (debugDisableShadows) {
      result.maskFilter = null;
    }
    return true;
  }());
  return result;
}