BeuiSmoothScroll class

Provider that tracks the nearest descendant scrollable and exposes the shared scroll state — the Flutter port of the source SmoothScroll (Lenis provider).

Documented reduced parity (spec §7): Lenis exists to re-add inertial smoothing to the browser's stepped wheel scrolling. Flutter scrolling is already physics-driven on every platform, so Lenis' replacement of the platform scroller is deliberately not re-implemented — a wrapper cannot suppress the wheel step an inner Scrollable applies (it wins the PointerSignalResolver, being deeper in the hit-test path), and taking the scroll position away from Flutter's own physics would cost more than it buys. What carries over is the shared state (scrollY / progress / velocity), the eased programmatic BeuiSmoothScrollApi.scrollTo with Lenis' expo-out curve and 1.2s default duration, and the knobs below, each mapped onto the Flutter scroll model rather than onto Lenis' internals: orientation, wheelMultiplier, touch and lerp.

Under reduced motion the whole smoothing layer is bypassed and the platform scroller is handed back full control (spec §6) — matching the source, whose reduced-motion branch renders a plain <div> with no Lenis at all. State tracking and an instant BeuiSmoothScrollApi.scrollTo remain.

Scroll-group widgets (progress bars/rings, scroll-to buttons) find this via BeuiSmoothScroll.of.

Inheritance

Constructors

BeuiSmoothScroll({required Widget child, BeuiSmoothScrollOrientation orientation = BeuiSmoothScrollOrientation.vertical, double lerp = 0.1, Duration duration = const Duration(milliseconds: 1200), double wheelMultiplier = 1.0, bool touch = false, Key? key})
Creates a smooth-scroll provider around a subtree containing the scrollable to track.
const

Properties

child Widget
The subtree; the outermost scrollable inside it whose axis matches orientation is tracked.
final
duration Duration
Default BeuiSmoothScrollApi.scrollTo glide duration (source duration = 1.2).
final
hashCode int
The hash code for this object.
no setterinherited
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
lerp double
Smoothing factor; lower is smoother and heavier (source lerp = 0.1).
final
orientation BeuiSmoothScrollOrientation
Which axis this provider drives (source orientation, default BeuiSmoothScrollOrientation.vertical).
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
touch bool
Whether smoothing also applies to touch input (source touch = false).
final
wheelMultiplier double
Wheel scroll speed multiplier (source wheelMultiplier = 1).
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() State<BeuiSmoothScroll>
Creates the mutable state for this widget at a given location in the tree.
override
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object.
inherited
toStringShort() String
A short, textual description of this widget.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

maybeOf(BuildContext context) BeuiSmoothScrollApi?
The nearest enclosing provider's API, or null when there is none.
of(BuildContext context) BeuiSmoothScrollApi
The nearest enclosing provider's API.