ImageFilterConfig.blur constructor
Creates a configuration for a Gaussian blur.
The sigmaX and sigmaY arguments are the standard deviation of the
Gaussian kernel in the x and y directions, respectively.
The tileMode argument determines how the blur should handle edges.
The bounded argument (defaults to false) controls the sampling strategy:
- If false, the filter is applied to the entire canvas using standard sampling.
- If true, the filter performs a "bounded blur", typically used to replicate the high-fidelity frosted-glass effect seen on iOS.
In "bounded blur" mode, the kernel samples exclusively from within the bounding rectangle of the object. Pixels outside the bounds are treated as transparent, and the result is normalized to maintain full opacity at the edges. This mode prevents color bleeding from adjacent content.
Unlike the low-level API ui.ImageFilter.blur, this constructor does not require an explicit Rect. Because ImageFilterConfig is resolved during the painting phase, it automatically uses the Rect bounds provided by the ImageFilterContext. This ensures the effect stays perfectly synchronized with the layout without manual coordinate management.
This mode only restricts the blur's sampling source; it does not clip the output. This should almost always be paired with a clipping widget (e.g., ClipRect) to avoid seeing blur artifacts beyond the object's boundaries.
Implementation
const factory ImageFilterConfig.blur({
double sigmaX,
double sigmaY,
ui.TileMode tileMode,
bool bounded,
}) = _BlurImageFilterConfig;