cssShadow static method

BoxShadow cssShadow(
  1. double x,
  2. double y,
  3. double blur,
  4. Color color,
)

A CSS box-shadow as a BoxShadow with the same Gaussian: CSS takes the blur as 2σ, while Flutter's blurRadius maps to σ = r · 0.57735 + 0.5.

Implementation

static BoxShadow cssShadow(double x, double y, double blur, Color color) =>
    BoxShadow(offset: Offset(x, y), blurRadius: blur <= 0 ? 0 : math.max(0, (blur / 2 - .5) / .57735), color: color);