Skip to content
pubscout

visual_effect

0.0.5, released 3 years ago by romainrastel.com

VisualEffect API for Flutter to easily add paint effects on your widgets.

WASM-ready
$ flutter pub add visual_effect
Source repository

What it does

Provides a VisualEffect API for Flutter to easily apply paint effects and scroll animations on your widgets. It includes features like grayscale, scaling, and translation based on scroll phases.

AI-written summary of version 0.0.5, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You want to apply custom scroll animations and paint effects to widgets.
  • You need to create card stack or similar scroll-driven visual effects.

Skip it when

  • You need a stable, production-ready API since the package is currently experimental.
  • You cannot set `addRepaintBoundaries` to false in parent Slivers or ScrollViews.

Strengths

  • Easy to apply scroll animations and visual paint effects.
  • Flexible modifier extensions like grayscale, scale, and translate.

Weaknesses

  • Experimental package with APIs that can change at any time.
  • Requires `addRepaintBoundaries` to be set to false in parent ScrollViews/Slivers.

Setup

Kind
Flutter widgets
Effort
Low
Code generation
No
Direct dependencies
2

not documented

ScrollEffect(
  onGenerateVisualEffect: (effect, phase) {
    return effect
        .grayscale(phase.leadingLerp(to: 0.5))
        .scale(
          x: phase.isLeading ? phase.leadingLerp(from: 1, to: 0.9) : 1,
          anchor: Alignment.topCenter,
        )
        .translate(y: effect.childSize.height * phase.leading);
  },
  child: const _CardItem(),
)

Alternatives

Packages that do the same job and could replace visual_effect.

Works with

Packages commonly used together with visual_effect: ones it builds on, ones built on it, and its own family.