copyWith method

  1. @useResult
FSheetStyle copyWith({
  1. ImageFilter barrierFilter(
    1. double
    )?,
  2. Duration? enterDuration,
  3. Duration? exitDuration,
  4. double? flingVelocity,
  5. double? closeProgressThreshold,
})

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

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

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),
);

enterDuration

The entrance duration. Defaults to 200ms.

exitDuration

The exit duration. Defaults to 200ms.

flingVelocity

The minimum velocity to initiate a fling. Defaults to 700.

Contract

Throws an AssertionError if the value is not positive.

closeProgressThreshold

The threshold for determining whether the sheet is closing. Defaults to 0.5.

Contract

Throws an AssertionError if the value is not in the range [0, 1].

Implementation

@useResult
FSheetStyle copyWith({
  ImageFilter Function(double)? barrierFilter,
  Duration? enterDuration,
  Duration? exitDuration,
  double? flingVelocity,
  double? closeProgressThreshold,
}) => FSheetStyle(
  barrierFilter: barrierFilter ?? this.barrierFilter,
  enterDuration: enterDuration ?? this.enterDuration,
  exitDuration: exitDuration ?? this.exitDuration,
  flingVelocity: flingVelocity ?? this.flingVelocity,
  closeProgressThreshold: closeProgressThreshold ?? this.closeProgressThreshold,
);