ViewportOffset class Null safety
Which part of the content inside the viewport should be visible.
The pixels value determines the scroll offset that the viewport uses to select which part of its content to display. As the user scrolls the viewport, this value changes, which changes the content that is displayed.
This object is a Listenable that notifies its listeners when pixels changes.
See also:
- ScrollPosition, which is a commonly used concrete subclass.
- RenderViewportBase, which is a render object that uses viewport offsets.
- Inheritance
-
- Object
- ChangeNotifier
- ViewportOffset
- Implementers
Constructors
- ViewportOffset()
- Default constructor.
- ViewportOffset.fixed(double value)
-
Creates a viewport offset with the given pixels value.
factory
- ViewportOffset.zero()
-
Creates a viewport offset with a pixels value of 0.0.
factory
Properties
- allowImplicitScrolling → bool
-
Whether a viewport is allowed to change pixels implicitly to respond to
a call to RenderObject.showOnScreen.
read-only
- hashCode → int
-
The hash code for this object.
read-onlyinherited
- hasListeners → bool
- Whether any listeners are currently registered.
- hasPixels → bool
-
Whether the pixels property is available.
read-only
- pixels → double
-
The number of pixels to offset the children in the opposite of the axis direction.
read-only
- runtimeType → Type
-
A representation of the runtime type of the object.
read-onlyinherited
- userScrollDirection → ScrollDirection
-
The direction in which the user is trying to change pixels, relative to
the viewport's RenderViewportBase.axisDirection.
read-only
Methods
-
addListener(
VoidCallback listener) → void -
Register a closure to be called when the object changes.
inherited
-
animateTo(
double to, {required Duration duration, required Curve curve}) → Future< void> - Animates pixels from its current value to the given value.
-
applyContentDimensions(
double minScrollExtent, double maxScrollExtent) → bool - Called when the viewport's content extents are established.
-
applyViewportDimension(
double viewportDimension) → bool - Called when the viewport's extents are established.
-
correctBy(
double correction) → void - Apply a layout-time correction to the scroll offset.
-
debugFillDescription(
List< String> description) → void -
Add additional information to the given description for use by toString.
mustCallSuper">@mustCallSuper
-
dispose(
) → void -
Discards any resources used by the object. After this is called, the
object is not in a usable state and should be discarded (calls to
addListener will throw after the object is disposed).
mustCallSuper">@mustCallSuperinherited
-
jumpTo(
double pixels) → void -
Jumps
pixels
from its current value to the given value, without animation, and without checking if the new value is in range. -
moveTo(
double to, {Duration? duration, Curve? curve, bool? clamp}) → Future< void> - Calls jumpTo if duration is null or Duration.zero, otherwise animateTo is called.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent method or property is accessed.
inherited
-
notifyListeners(
) → void - Call all the registered listeners.
-
removeListener(
VoidCallback listener) → void -
Remove a previously registered closure from the list of closures that are
notified when the object changes.
inherited
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited