I wanted to blur my image, I tried this:
BackdropFilter(
filter: ImageFilter.blur(
sigmaX: 10,
sigmaY: 10
),
child: Image.file(
File(imagePath),
fit: BoxFit.cover,
)
)
but my problem is that is not applying to the image and I am honestly no idea why?
2
Answers
BackdropFilter applies a blur only to the content behind it, not the child widget itself. In your case, since the Image.file is the direct child, the blur won’t be applied to the image as you expected. I’ve used a network image to show an example that is easy to apply.
Use
ImageFiltered
. It’s more performant.BackdropFilter
created for "Frosted Glass" effect to blur background.Also,
BackdropFilter
blurs everything behind your widget andImageFiltered
affects only it’s child.