center property

Key? center

The first child in the GrowthDirection.forward growth direction.

Children after center will be placed in the axisDirection relative to the center. Children before center will be placed in the opposite of the axisDirection relative to the center.

The center must be the key of a child of the viewport.

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 Key? center;