Skip to content

ScrollView

A scrollable viewport onto a single child.

See also: ListView for virtualized, selectable lists.

Learn more: Lists & scrolling

Import: package:fleury/fleury.dart, or package:fleury/fleury_core.dart in browser code.

ScrollView(child: Column(children: [/* tall content */]))

When the viewport itself is focused, claims:

  • Up / Down (vertical), Left / Right (horizontal) — scroll one cell.
  • PageUp / PageDown — scroll a viewport’s worth.
  • Home / End — jump to the start / end.

With a focused descendant, unhandled arrows navigate between controls and reveal the next control, including one outside the viewport. Other scroll chords still scroll this view when the descendant does not handle them. Editors and lists receive their keys before this enclosing viewport.

At either edge, edgeBehavior decides whether the key is consumed (contain) or returned to the focus chain (bubble) so an ancestor — e.g. a pane coordinator — can move focus instead.

ParameterTypeDefaultDescription
child:WidgetrequiredThe full content subtree; it is laid out eagerly and clipped to the viewport.
controller:ScrollController?—External controller. If null, the widget creates and disposes its own.
scrollDirection:AxisAxis.verticalThe axis along which content scrolls. The other axis stays constrained.
focusNode:FocusNode?—External focus node. If null, the widget creates and disposes its own.
autofocus:boolfalseWhether to request focus on first mount.
edgeBehavior:EdgeBehaviorEdgeBehavior.bubbleHow scroll keys and wheel gestures behave at an edge. With a focused descendant, main-axis arrows first navigate controls within this view; when no target remains, contain stops the arrow and bubble lets an enclosing traversal group move focus outside. Tab is unaffected.
scrollbar:boolfalseWhen true, wrap the viewport in a Scrollbar gutter that reflects the scroll position and lets the mouse drag/click to scroll. A one-line opt-in sharing this view’s own controller. More
showScrollbarWhenFits:booltrueWhether an enabled scrollbar draws a full thumb when content fits. False keeps the gutter stable but draws the bar only while overflowing.
  • scrollbar: The gutter is on the right for vertical scrolling and below the content for horizontal scrolling. It needs a bounded cross axis: width for a vertical view, height for a horizontal one.

ScrollView is defined in packages/fleury/lib/src/widgets/scroll_view.dart.

Category: Lists & data · All widgets