userScrollDirection property

  1. @override
ScrollDirection get userScrollDirection
override

The direction in which the user is trying to change pixels, relative to the viewport's RenderViewportBase.axisDirection.

If the user is not scrolling, this will return ScrollDirection.idle even if there is (for example) a ScrollActivity currently animating the position.

This is exposed in SliverConstraints.userScrollDirection, which is used by some slivers to determine how to react to a change in scroll offset. For example, RenderSliverFloatingPersistentHeader will only expand a floating app bar when the userScrollDirection is in the positive scroll offset direction.

{@tool dartpad} This sample shows a CustomScrollView, with Radio buttons in the AppBar.bottom that change the AxisDirection to illustrate different configurations. With a NotificationListener to listen to UserScrollNotifications, which occur when the ScrollDirection changes or stops.

** See code in examples/api/lib/rendering/scroll_direction/scroll_direction.0.dart ** {@end-tool}

Implementation

@override
ScrollDirection get userScrollDirection => throw UnimplementedError();