scroll_transition library

SwiftUI-style scroll transitions and visual effects for Flutter.

  • ScrollTransition: fade, scale, rotate, blur or slide children from their phase in the nearest scroll viewport.
  • VisualEffect: arbitrary paint-time effects from a child's viewport geometry.
  • ScrollEffects: composable ready-made effects.

Classes

RenderVisualEffect
Measures its own rect relative to the nearest viewport on every paint, then paints its child through transform, opacity, colour-filter and image-filter layers computed from that geometry.
ScrollEffect
A composable, immutable description of how a widget looks at each ScrollTransitionPhase.
ScrollEffects
Ready-made ScrollEffects. Chain more with the instance methods of the same name: ScrollEffects.fade().scale(0.8).
ScrollTransition
Animates child from its position inside the nearest scroll viewport, like SwiftUI's .scrollTransition.
ScrollTransitionConfiguration
How the phase follows the scroll position. Mirrors SwiftUI's ScrollTransitionConfiguration.
ScrollTransitionPhase
Where a widget is in its scroll transition, as a value from -1 to 1.
VisualEffect
Applies an arbitrary visual effect computed from the widget's geometry in its scroll viewport, like SwiftUI's .visualEffect.
VisualEffectGeometry
Where a widget sits in its nearest scroll viewport, measured during the paint phase of the current frame.
VisualEffectValues
A set of paint-time visual adjustments: opacity, transform, blur and saturation. They never affect layout. Mirrors the modifiers SwiftUI allows inside .visualEffect and .scrollTransition.

Enums

ScrollPhase
The three discrete states of a scroll transition, mirroring SwiftUI's ScrollTransitionPhase.

Typedefs

PaintGeometryCallback = bool Function(VisualEffectGeometry geometry)
Called during paint with the measured geometry. Returns whether the child should be painted this frame.
ScrollEffectCallback = VisualEffectValues Function(ScrollTransitionPhase phase)
Computes VisualEffectValues from a phase. Used by ScrollEffects.custom.
ScrollTransitionWidgetBuilder = Widget Function(BuildContext context, Widget? child, ScrollTransitionPhase phase)
Builds a widget from the current ScrollTransitionPhase.
VisualEffectCallback = VisualEffectValues Function(VisualEffectGeometry geometry)
Computes paint-time VisualEffectValues from the current geometry.
VisualEffectWidgetBuilder = Widget Function(BuildContext context, Widget? child, VisualEffectGeometry geometry)
Builds a widget from the current VisualEffectGeometry.