growthDirection property

GrowthDirection growthDirection

The direction in which the contents of slivers are ordered, relative to the axisDirection.

For example, if the axisDirection is AxisDirection.up, and the growthDirection is GrowthDirection.forward, then an alphabetical list will have A at the bottom, then B, then C, and so forth, with Z at the top, with the bottom of the A at scroll offset zero, and the top of the Z at the highest scroll offset.

If a viewport has an overall AxisDirection of AxisDirection.down, then slivers above the absolute zero offset will have an axis of AxisDirection.up and a growth direction of GrowthDirection.reverse, while slivers below the absolute zero offset will have the same axis direction as the viewport and a growth direction of GrowthDirection.forward. (The slivers with a reverse growth direction still see only positive scroll offsets; the scroll offsets are reversed as well, with zero at the absolute zero point, and positive numbers going away from there.)

Normally, the absolute zero offset is determined by the viewport's and RenderViewport.anchor properties.

Most scroll views by default are ordered GrowthDirection.forward. Changing the default values of ScrollView.anchor,, or both, can configure a scroll view for GrowthDirection.reverse.

This sample shows a CustomScrollView, with Radio buttons in the AppBar.bottom that change the AxisDirection to illustrate different configurations. The CustomScrollView.anchor and properties are also set to have the 0 scroll offset positioned in the middle of the viewport, with GrowthDirection.forward and GrowthDirection.reverse illustrated on either side. The sliver that shares the key is positioned at the CustomScrollView.anchor.

To create a local project with this code sample, run:
flutter create --sample=cupertino.GrowthDirection.1 mysample


final GrowthDirection growthDirection;