copyWith method

  1. @useResult
FPopoverMenuStyle copyWith({
  1. FItemGroupStyle itemGroupStyle(
    1. FItemGroupStyle
    )?,
  2. FTileGroupStyle tileGroupStyle(
    1. FTileGroupStyle
    )?,
  3. double? maxWidth,
  4. BoxDecoration? decoration,
  5. ImageFilter barrierFilter(
    1. double
    )?,
  6. ImageFilter backgroundFilter(
    1. double
    )?,
  7. EdgeInsetsGeometry? viewInsets,
})

Returns a copy of this FPopoverMenuStyle with the given properties replaced.

Where possible, it is strongly recommended to use the CLI to generate a style and directly modify the style.

itemGroupStyle

The item group's style.

tileGroupStyle

The tile group's style.

maxWidth

The menu's max width. Defaults to 250.

Contract

Throws AssertionError if the width is not positive.

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
FPopoverMenuStyle copyWith({
  FItemGroupStyle Function(FItemGroupStyle)? itemGroupStyle,
  FTileGroupStyle Function(FTileGroupStyle)? tileGroupStyle,
  double? maxWidth,
  BoxDecoration? decoration,
  ImageFilter Function(double)? barrierFilter,
  ImageFilter Function(double)? backgroundFilter,
  EdgeInsetsGeometry? viewInsets,
}) => FPopoverMenuStyle(
  itemGroupStyle: itemGroupStyle != null ? itemGroupStyle(this.itemGroupStyle) : this.itemGroupStyle,
  tileGroupStyle: tileGroupStyle != null ? tileGroupStyle(this.tileGroupStyle) : this.tileGroupStyle,
  maxWidth: maxWidth ?? this.maxWidth,
  decoration: decoration ?? this.decoration,
  barrierFilter: barrierFilter ?? this.barrierFilter,
  backgroundFilter: backgroundFilter ?? this.backgroundFilter,
  viewInsets: viewInsets ?? this.viewInsets,
);