giordy16
giordy16

Reputation: 366

How to have a blur effect with Paint()

I would like to recreate the blurring effect that is done by BackdropFilter

ClipRect(
              child: BackdropFilter(
                filter: ui.ImageFilter.blur(sigmaX: 15, sigmaY: 15),
                child: Container(
                  width: 300,
                  height: 300,
                ),
              ),
            ),

using Canvas. What I am doing now is

Paint paint = Paint()
      ..color = Colors.white
      ..imageFilter = ui.ImageFilter.blur(sigmaX: 15, sigmaY: 15)
      ..blendMode = BlendMode.srcOver;

but the effect is not the same as the one made by BackdropFilter. Effect with BackdropFilter

Effect with Painter

Upvotes: 0

Views: 307

Answers (0)

Related Questions