ScrollMetricsNotification class Null safety

A notification that a scrollable widget's ScrollMetrics have changed.

For example, when the content of a scrollable is altered, making it larger or smaller, this notification will be dispatched. Similarly, if the size of the window or parent changes, the scrollable can notify of these changes in dimensions.

The above behaviors usually do not trigger ScrollNotification events, so this is useful for listening to ScrollMetrics changes that are not caused by the user scrolling.

This sample shows how a ScrollMetricsNotification is dispatched when the windowSize is changed. Press the floating action button to increase the scrollable window's size.
To create a local project with this code sample, run:
flutter create --sample=widgets.ScrollMetricsNotification.1 mysample

Inheritance
Mixed in types

Constructors

ScrollMetricsNotification({required ScrollMetrics metrics, required BuildContext context})
Creates a notification that the scrollable widget's ScrollMetrics have changed.

Properties

context BuildContext
The build context of the widget that fired this notification. [...]
final
depth int
The number of viewports that this notification has bubbled through. [...]
read-only, inherited
hashCode int
The hash code for this object. [...]
read-only, inherited
metrics ScrollMetrics
Description of a scrollable widget's ScrollMetrics.
final
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited

Methods

debugFillDescription(List<String> description) → void
Add additional information to the given description for use by toString. [...]
override
dispatch(BuildContext? target) → void
Start bubbling this notification at the given build context. [...]
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
toString() String
A string representation of this object. [...]
inherited
visitAncestor(Element element) bool
Applied to each ancestor of the dispatch target. [...]
inherited

Operators

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