Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 80f390e

Browse files
committed
adjust blur radius for HTML to match CanvasKit
1 parent 6a6986d commit 80f390e

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

lib/web_ui/lib/src/engine/html/scene_builder.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -563,9 +563,9 @@ class SurfaceSceneBuilder implements ui.SceneBuilder {
563563
}
564564
}
565565

566-
// TODO(yjbanov): in HTML the blur looks too aggressive. The current
567-
// implementation was copied from the existing backdrop-filter
568-
// but probably needs a revision.
566+
// HTML only supports a single radius, but Flutter ImageFilter supports separate
567+
// horizontal and vertical radii. The best approximation we can provide is to
568+
// average the two radii together for a single compromise value.
569569
String _imageFilterToCss(EngineImageFilter filter) {
570-
return 'blur(${math.max(filter.sigmaX, filter.sigmaY) * 2}px)';
570+
return 'blur(${(filter.sigmaX + filter.sigmaY) / 2}px)';
571571
}

0 commit comments

Comments
 (0)