backgroundFilter property
An optional background filter. This only takes effect if the decoration has a transparent or translucent background color.
This is typically combined with a transparent/translucent background to create a glassmorphic effect.
There will be a flicker after the toast's fade-in entrance when a blur background filter is applied. This is due to https://github.com/flutter/flutter/issues/31706.
Examples
// Blurred
ImageFilter.blur(sigmaX: 5, sigmaY: 5);
// Solid color
ColorFilter.mode(Colors.white, BlendMode.srcOver);
// Tinted
ColorFilter.mode(Colors.white.withValues(alpha: 0.5), BlendMode.srcOver);
// Blurred & tinted
ImageFilter.compose(
outer: ImageFilter.blur(sigmaX: 5, sigmaY: 5),
inner: ColorFilter.mode(Colors.white.withValues(alpha: 0.5), BlendMode.srcOver),
);
Implementation
@override
final ImageFilter? backgroundFilter;