ScrollBehavior class
Describes how Scrollable widgets should behave.
Used by ScrollConfiguration to configure the Scrollable widgets in a subtree.
This class can be extended to further customize a ScrollBehavior for a subtree. For example, overriding ScrollBehavior.getScrollPhysics sets the default ScrollPhysics for Scrollables that inherit this ScrollConfiguration. Overriding ScrollBehavior.buildOverscrollIndicator can be used to add or change the default GlowingOverscrollIndicator decoration, while ScrollBehavior.buildScrollbar can be changed to modify the default Scrollbar.
When looking to easily toggle the default decorations, you can use
ScrollBehavior.copyWith instead of creating your own ScrollBehavior class.
The scrollbar
and overscrollIndicator
flags can turn these decorations off.
See also:
- ScrollConfiguration, the inherited widget that controls how Scrollable widgets behave in a subtree.
- Implementers
- Annotations
Constructors
- ScrollBehavior()
-
Creates a description of how Scrollable widgets should behave.
const
Properties
-
dragDevices
→ Set<
PointerDeviceKind> -
The device kinds that the scrollable will accept drag gestures from.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
-
pointerAxisModifiers
→ Set<
LogicalKeyboardKey> -
A set of LogicalKeyboardKeys that, when any or all are pressed in
combination with a PointerDeviceKind.mouse pointer scroll event, will
flip the axes of the scroll input.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
buildOverscrollIndicator(
BuildContext context, Widget child, ScrollableDetails details) → Widget - Applies a GlowingOverscrollIndicator to the child widget on TargetPlatform.android and TargetPlatform.fuchsia.
-
buildScrollbar(
BuildContext context, Widget child, ScrollableDetails details) → Widget - Applies a RawScrollbar to the child widget on desktop platforms.
-
copyWith(
{bool? scrollbars, bool? overscroll, Set< PointerDeviceKind> ? dragDevices, MultitouchDragStrategy? multitouchDragStrategy, Set<LogicalKeyboardKey> ? pointerAxisModifiers, ScrollPhysics? physics, TargetPlatform? platform}) → ScrollBehavior -
Creates a copy of this ScrollBehavior, making it possible to
easily toggle
scrollbar
andoverscrollIndicator
effects. -
getMultitouchDragStrategy(
BuildContext context) → MultitouchDragStrategy - Configure the multi-finger drag strategy on multi-touch devices.
-
getPlatform(
BuildContext context) → TargetPlatform - The platform whose scroll physics should be implemented.
-
getScrollPhysics(
BuildContext context) → ScrollPhysics - The scroll physics to use for the platform given by getPlatform.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
shouldNotify(
covariant ScrollBehavior oldDelegate) → bool - Called whenever a ScrollConfiguration is rebuilt with a new ScrollBehavior of the same runtimeType.
-
toString(
) → String -
A string representation of this object.
override
-
velocityTrackerBuilder(
BuildContext context) → GestureVelocityTrackerBuilder - Specifies the type of velocity tracker to use in the descendant Scrollables' drag gesture recognizers, for estimating the velocity of a drag gesture.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited