GlowingOverscrollIndicator class
A visual indication that a scroll view has overscrolled.
A GlowingOverscrollIndicator listens for ScrollNotifications in order to control the overscroll indication. These notifications are typically generated by a ScrollView, such as a ListView or a GridView.
GlowingOverscrollIndicator generates OverscrollIndicatorNotification before showing an overscroll indication. To prevent the indicator from showing the indication, call OverscrollIndicatorNotification.disallowIndicator on the notification.
Created automatically by ScrollBehavior.buildOverscrollIndicator on platforms (e.g., Android) that commonly use this type of overscroll indication.
In a MaterialApp, the edge glow color is the overall theme's ColorScheme.secondary color.
Customizing the Glow Position for Advanced Scroll Views
When building a CustomScrollView with a GlowingOverscrollIndicator, the indicator will apply to the entire scrollable area, regardless of what slivers the CustomScrollView contains.
For example, if your CustomScrollView contains a SliverAppBar in the first position, the GlowingOverscrollIndicator will overlay the SliverAppBar. To manipulate the position of the GlowingOverscrollIndicator in this case, you can either make use of a NotificationListener and provide a OverscrollIndicatorNotification.paintOffset to the notification, or use a NestedScrollView.
To create a local project with this code sample, run:
flutter create --sample=widgets.GlowingOverscrollIndicator.1 mysample
To create a local project with this code sample, run:
flutter create --sample=widgets.GlowingOverscrollIndicator.2 mysample
See also:
- OverscrollIndicatorNotification, which can be used to manipulate the glow position or prevent the glow from being painted at all.
- NotificationListener, to listen for the OverscrollIndicatorNotification.
- StretchingOverscrollIndicator, a Material Design overscroll indicator.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- GlowingOverscrollIndicator
Constructors
- GlowingOverscrollIndicator({Key? key, bool showLeading = true, bool showTrailing = true, required AxisDirection axisDirection, required Color color, ScrollNotificationPredicate notificationPredicate = defaultScrollNotificationPredicate, Widget? child})
-
Creates a visual indication that a scroll view has overscrolled.
const
Properties
- axis → Axis
-
The axis along which scrolling occurs in the Scrollable whose
overscrolls are to be visualized.
no setter
- axisDirection → AxisDirection
-
The direction of positive scroll offsets in the Scrollable whose
overscrolls are to be visualized.
final
- child → Widget?
-
The widget below this widget in the tree.
final
- color → Color
-
The color of the glow. The alpha channel is ignored.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- notificationPredicate → ScrollNotificationPredicate
-
A check that specifies whether a ScrollNotification should be
handled by this widget.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- showLeading → bool
-
Whether to show the overscroll glow on the side with negative scroll
offsets.
final
- showTrailing → bool
-
Whether to show the overscroll glow on the side with positive scroll
offsets.
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< GlowingOverscrollIndicator> -
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.
override
-
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, int wrapWidth = 65}) → 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