A box in which a single widget can be scrolled.

This widget is useful when you have a single box that will normally be entirely visible, for example a clock face in a time picker, but you need to make sure it can be scrolled if the container gets too small in one axis (the scroll direction).

It is also useful if you need to shrink-wrap in both axes (the main scrolling direction as well as the cross axis), as one might see in a dialog or pop-up menu. In that case, you might pair the SingleChildScrollView with a ListBody child.

When you have a list of children and do not require cross-axis shrink-wrapping behavior, for example a scrolling list that is always the width of the screen, consider ListView, which is vastly more efficient that a SingleChildScrollView containing a ListBody or Column with many children.

See also:

  • ListView, which handles multiple children in a scrolling list.
  • GridView, which handles multiple children in a scrolling grid.
  • PageView, for a scrollable that works page by page.
  • Scrollable, which handles arbitrary scrolling effects.
Inheritance

Constructors

SingleChildScrollView({Key key, Axis scrollDirection: Axis.vertical, bool reverse: false, EdgeInsetsGeometry padding, bool primary, ScrollPhysics physics, ScrollController controller, Widget child })
Creates a box in which a single widget can be scrolled.

Properties

child Widget
The widget that scrolls.
final
controller ScrollController
An object that can be used to control the position to which this scroll view is scrolled. [...]
final
padding EdgeInsetsGeometry
The amount of space by which to inset the child.
final
physics ScrollPhysics
How the scroll view should respond to user input. [...]
final
primary bool
Whether this is the primary scroll view associated with the parent PrimaryScrollController. [...]
final
reverse bool
Whether the scroll view scrolls in the reading direction. [...]
final
scrollDirection Axis
The axis along which the scroll view scrolls. [...]
final
hashCode int
The hash code for this object. [...]
read-only, inherited
key Key
Controls how one widget replaces another widget in the tree. [...]
final, inherited
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited

Methods

build(BuildContext context) Widget
Describes the part of the user interface represented by this widget. [...]
createElement() StatelessElement
Creates a StatelessElement to manage this widget's location in the tree. [...]
inherited
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children. [...]
@protected, inherited
debugFillProperties(DiagnosticPropertiesBuilder description) → void
Add additional properties associated with the node. [...]
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
toDiagnosticsNode({String name, DiagnosticsTreeStyle style }) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by toStringDeep. [...]
inherited
toString({DiagnosticLevel minLevel: DiagnosticLevel.debug }) String
Returns a string representation of this object.
inherited
toStringDeep({String prefixLineOne: '', String prefixOtherLines, DiagnosticLevel minLevel: DiagnosticLevel.debug }) String
Returns a string representation of this node and its descendants. [...]
inherited
toStringShallow({String joiner: ', ', DiagnosticLevel minLevel: DiagnosticLevel.debug }) String
Returns a one-line detailed description of the object. [...]
inherited
toStringShort() String
A short, textual description of this widget.
inherited

Operators

operator ==(other) bool
The equality operator. [...]
inherited