SliverConstraints class Null safety

Immutable layout constraints for RenderSliver layout.

The SliverConstraints describe the current scroll state of the viewport from the point of view of the sliver receiving the constraints. For example, a scrollOffset of zero means that the leading edge of the sliver is visible in the viewport, not that the viewport itself has a zero scroll offset.

Inheritance

Constructors

SliverConstraints({required AxisDirection axisDirection, required GrowthDirection growthDirection, required ScrollDirection userScrollDirection, required double scrollOffset, required double precedingScrollExtent, required double overlap, required double remainingPaintExtent, required double crossAxisExtent, required AxisDirection crossAxisDirection, required double viewportMainAxisExtent, required double remainingCacheExtent, required double cacheOrigin})
Creates sliver constraints with the given information.
const

Properties

axis Axis
The axis along which the scrollOffset and remainingPaintExtent are measured.
read-only
axisDirection AxisDirection
The direction in which the scrollOffset and remainingPaintExtent increase.
final
cacheOrigin double
Where the cache area starts relative to the scrollOffset.
final
crossAxisDirection AxisDirection
The direction in which children should be placed in the cross axis.
final
crossAxisExtent double
The number of pixels in the cross-axis.
final
growthDirection GrowthDirection
The direction in which the contents of slivers are ordered, relative to the axisDirection.
final
hashCode int
The hash code for this object.
read-onlyoverride
isNormalized bool
Whether the constraint is expressed in a consistent manner.
read-onlyoverride
isTight bool
Whether there is exactly one size possible given these constraints.
read-onlyoverride
normalizedGrowthDirection GrowthDirection
Return what the growthDirection would be if the axisDirection was either AxisDirection.down or AxisDirection.right.
read-only
overlap double
The number of pixels from where the pixels corresponding to the scrollOffset will be painted up to the first pixel that has not yet been painted on by an earlier sliver, in the axisDirection.
final
precedingScrollExtent double
The scroll distance that has been consumed by all RenderSlivers that came before this RenderSliver.
final
remainingCacheExtent double
Describes how much content the sliver should provide starting from the cacheOrigin.
final
remainingPaintExtent double
The number of pixels of content that the sliver should consider providing. (Providing more pixels than this is inefficient.)
final
runtimeType Type
A representation of the runtime type of the object.
read-onlyinherited
scrollOffset double
The scroll offset, in this sliver's coordinate system, that corresponds to the earliest visible part of this sliver in the AxisDirection if growthDirection is GrowthDirection.forward or in the opposite AxisDirection direction if growthDirection is GrowthDirection.reverse.
final
userScrollDirection ScrollDirection
The direction in which the user is attempting to scroll, relative to the axisDirection and growthDirection.
final
viewportMainAxisExtent double
The number of pixels the viewport can display in the main axis.
final

Methods

asBoxConstraints({double minExtent = 0.0, double maxExtent = double.infinity, double? crossAxisExtent}) BoxConstraints
Returns BoxConstraints that reflects the sliver constraints.
copyWith({AxisDirection? axisDirection, GrowthDirection? growthDirection, ScrollDirection? userScrollDirection, double? scrollOffset, double? precedingScrollExtent, double? overlap, double? remainingPaintExtent, double? crossAxisExtent, AxisDirection? crossAxisDirection, double? viewportMainAxisExtent, double? remainingCacheExtent, double? cacheOrigin}) SliverConstraints
Creates a copy of this object but with the given fields replaced with the new values.
debugAssertIsValid({bool isAppliedConstraint = false, InformationCollector? informationCollector}) bool
Asserts that the constraints are valid.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed.
inherited
toString() String
A string representation of this object.
override

Operators

operator ==(Object other) bool
The equality operator.
override