Skip to content

Latest commit

 

History

History
19 lines (16 loc) · 3.63 KB

File metadata and controls

19 lines (16 loc) · 3.63 KB

A widget that manages scrolling in one dimension and informs the Viewport through which the content is viewed.

Scrollable implements the interaction model for a scrollable widget, including gesture recognition, but does not have an opinion about how the viewport, which actually displays the children, is constructed.

It's rare to construct a Scrollable directly. Instead, consider ListView or GridView, which combine scrolling, viewporting, and a layout model. To combine layout models (or to use a custom layout mode), consider using CustomScrollView.

A widget through which a portion of larger content can be viewed, typically in combination with a Scrollable.

Viewport is the visual workhorse of the scrolling machinery. It displays a subset of its children according to its own dimensions and the given offset. As the offset varies, different children are visible through the viewport.

Viewport hosts a bidirectional list of slivers, anchored on a center sliver, which is placed at the zero scroll offset. The center widget is displayed in the viewport according to the anchor property.

Slivers that are earlier in the child list than center are displayed in reverse order in the reverse axisDirection starting from the center. For example, if the axisDirection is AxisDirection.down, the first sliver before center is placed above the center. The slivers that are later in the child list than center are placed in order in the axisDirection. For example, in the preceding scenario, the first sliver after center is placed below the center.

Viewport cannot contain box children directly. Instead, use a SliverList, SliverFixedExtentList, SliverGrid, or a SliverToBoxAdapter, for example.