copyWith method
- @useResult
- BoxDecoration? decoration,
- ImageFilter barrierFilter()?,
- ImageFilter backgroundFilter()?,
- EdgeInsetsGeometry? viewInsets,
Returns a copy of this FPopoverStyle with the given properties replaced.
Where possible, it is strongly recommended to use the CLI to generate a style and directly modify the style.
decoration
The popover's decoration.
barrierFilter
An optional callback that takes the current animation transition value (0.0 to 1.0) and returns an ImageFilter that is used as the barrier. Defaults to null.
Examples
// Blurred
(animation) => ImageFilter.blur(sigmaX: animation * 5, sigmaY: animation * 5);
// Solid color
(animation) => ColorFilter.mode(Colors.white.withValues(alpha: animation), BlendMode.srcOver);
// Tinted
(animation) => ColorFilter.mode(Colors.white.withValues(alpha: animation * 0.5), BlendMode.srcOver);
// Blurred & tinted
(animation) => ImageFilter.compose(
outer: ImageFilter.blur(sigmaX: animation * 5, sigmaY: animation * 5),
inner: ColorFilter.mode(Colors.white.withValues(alpha: animation * 0.5), BlendMode.srcOver),
);
backgroundFilter
An optional callback that takes the current animation transition value (0.0 to 1.0) and returns an ImageFilter that is used as the background. Defaults to null.
This is typically combined with a transparent/translucent background to create a glassmorphic effect.
Examples
// Blurred
(animation) => ImageFilter.blur(sigmaX: animation * 5, sigmaY: animation * 5);
// Solid color
(animation) => ColorFilter.mode(Colors.white.withValues(alpha: animation), BlendMode.srcOver);
// Tinted
(animation) => ColorFilter.mode(Colors.white.withValues(alpha: animation * 0.5), BlendMode.srcOver);
// Blurred & tinted
(animation) => ImageFilter.compose(
outer: ImageFilter.blur(sigmaX: animation * 5, sigmaY: animation * 5),
inner: ColorFilter.mode(Colors.white.withValues(alpha: animation * 0.5), BlendMode.srcOver),
);
viewInsets
The additional insets of the view. In other words, the minimum distance between the edges of the view and the edges of the popover. This applied in addition to the insets provided by MediaQueryData.viewPadding.
Defaults to EdgeInsets.all(5)
.
Implementation
@useResult
FPopoverStyle copyWith({
BoxDecoration? decoration,
ImageFilter Function(double)? barrierFilter,
ImageFilter Function(double)? backgroundFilter,
EdgeInsetsGeometry? viewInsets,
}) => FPopoverStyle(
decoration: decoration ?? this.decoration,
barrierFilter: barrierFilter ?? this.barrierFilter,
backgroundFilter: backgroundFilter ?? this.backgroundFilter,
viewInsets: viewInsets ?? this.viewInsets,
);