CupertinoScrollBehavior class Null safety
Describes how Scrollable widgets behave for CupertinoApps.
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.
Setting a CupertinoScrollBehavior will result in descendant Scrollable widgets using BouncingScrollPhysics by default. No GlowingOverscrollIndicator is applied when using a CupertinoScrollBehavior either, regardless of platform. When executing on desktop platforms, a CupertinoScrollbar is applied to the child.
See also:
- ScrollBehavior, the default scrolling behavior extended by this class.
- Inheritance
-
- Object
- ScrollBehavior
- CupertinoScrollBehavior
Constructors
- CupertinoScrollBehavior()
-
Creates a CupertinoScrollBehavior that uses BouncingScrollPhysics and
adds CupertinoScrollbars on desktop platforms.
const
Properties
- androidOverscrollIndicator → AndroidOverscrollIndicator
-
Specifies which overscroll indicator to use on TargetPlatform.android.
Deprecated('Use ThemeData.useMaterial3 or override ScrollBehavior.buildOverscrollIndicator. ' 'This feature was deprecated after v2.13.0-0.0.pre.')">@Deprecated('Use ThemeData.useMaterial3 or override ScrollBehavior.buildOverscrollIndicator. ' 'This feature was deprecated after v2.13.0-0.0.pre.')read-onlyinherited
-
dragDevices
→ Set<
PointerDeviceKind> -
The device kinds that the scrollable will accept drag gestures from.
read-onlyinherited
- hashCode → int
-
The hash code for this object.
read-onlyinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
read-onlyinherited
Methods
-
buildOverscrollIndicator(
BuildContext context, Widget child, ScrollableDetails details) → Widget -
Applies a GlowingOverscrollIndicator to the child widget on
TargetPlatform.android and TargetPlatform.fuchsia.
override
-
buildScrollbar(
BuildContext context, Widget child, ScrollableDetails details) → Widget -
Applies a RawScrollbar to the child widget on desktop platforms.
override
-
buildViewportChrome(
BuildContext context, Widget child, AxisDirection axisDirection) → Widget -
Wraps the given widget, which scrolls in the given AxisDirection.
Deprecated('Migrate to buildOverscrollIndicator. ' 'This feature was deprecated after v2.1.0-11.0.pre.')">@Deprecated('Migrate to buildOverscrollIndicator. ' 'This feature was deprecated after v2.1.0-11.0.pre.')inherited
-
copyWith(
{bool? scrollbars, bool? overscroll, Set< PointerDeviceKind> ? dragDevices, ScrollPhysics? physics, TargetPlatform? platform, AndroidOverscrollIndicator? androidOverscrollIndicator}) → ScrollBehavior -
Creates a copy of this ScrollBehavior, making it possible to
easily toggle
scrollbar
andoverscrollIndicator
effects.inherited -
getPlatform(
BuildContext context) → TargetPlatform -
The platform whose scroll physics should be implemented.
inherited
-
getScrollPhysics(
BuildContext context) → ScrollPhysics -
The scroll physics to use for the platform given by getPlatform.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent 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.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
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.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited