TwoDimensionalScrollable class

A widget that manages scrolling in both the vertical and horizontal dimensions and informs the TwoDimensionalViewport through which the content is viewed.

TwoDimensionalScrollable implements the interaction model for a scrollable widget in both the vertical and horizontal axes, including gesture recognition, but does not have an opinion about how the TwoDimensionalViewport, which actually displays the children, is constructed.

It's rare to construct a TwoDimensionalScrollable directly. Instead, consider subclassing TwoDimensionalScrollView, which combines scrolling, viewporting, and a layout model in both dimensions.

See also:

Inheritance

Constructors

TwoDimensionalScrollable({Key? key, required ScrollableDetails horizontalDetails, required ScrollableDetails verticalDetails, required TwoDimensionalViewportBuilder viewportBuilder, ScrollIncrementCalculator? incrementCalculator, String? restorationId, bool excludeFromSemantics = false, DiagonalDragBehavior diagonalDragBehavior = DiagonalDragBehavior.none, DragStartBehavior dragStartBehavior = DragStartBehavior.start, HitTestBehavior hitTestBehavior = HitTestBehavior.opaque})
Creates a widget that scrolls in two dimensions.
const

Properties

diagonalDragBehavior DiagonalDragBehavior
How scrolling gestures should lock to one axis, or allow free movement in both axes.
final
dragStartBehavior DragStartBehavior
Determines the way that drag start behavior is handled.
final
excludeFromSemantics bool
Whether the scroll actions introduced by this Scrollable are exposed in the semantics tree.
final
hashCode int
The hash code for this object.
no setterinherited
hitTestBehavior HitTestBehavior
Defines the behavior of gesture detector used in this Scrollable.
final
horizontalDetails ScrollableDetails
The configuration of the horizontal Scrollable.
final
incrementCalculator ScrollIncrementCalculator?
An optional function that will be called to calculate the distance to scroll when the scrollable is asked to scroll via the keyboard using a ScrollAction.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
restorationId String?
Restoration ID to save and restore the scroll offset of the scrollable.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
verticalDetails ScrollableDetails
The configuration of the vertical Scrollable.
final
viewportBuilder TwoDimensionalViewportBuilder
Builds the viewport through which the scrollable content is displayed.
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() State<TwoDimensionalScrollable>
Creates the mutable state for this widget at a given location in the tree.
override
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent 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 DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
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 ==(Object other) bool
The equality operator.
inherited

Static Methods

maybeOf(BuildContext context) TwoDimensionalScrollableState?
The state from the closest instance of this class that encloses the given context, or null if none is found.
of(BuildContext context) TwoDimensionalScrollableState
The state from the closest instance of this class that encloses the given context.