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.



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.


axis Axis
The axis along which the scrollOffset and remainingPaintExtent are measured.
axisDirection AxisDirection
The direction in which the scrollOffset and remainingPaintExtent increase.
cacheOrigin double
Where the cache area starts relative to the scrollOffset.
crossAxisDirection AxisDirection
The direction in which children should be placed in the cross axis.
crossAxisExtent double
The number of pixels in the cross-axis.
growthDirection GrowthDirection
The direction in which the contents of slivers are ordered, relative to the axisDirection.
hashCode int
The hash code for this object.
read-only, override
isNormalized bool
Whether the constraint is expressed in a consistent manner.
read-only, override
isTight bool
Whether there is exactly one size possible given these constraints.
read-only, override
normalizedGrowthDirection GrowthDirection
Return what the growthDirection would be if the axisDirection was either AxisDirection.down or AxisDirection.right.
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.
precedingScrollExtent double
The scroll distance that has been consumed by all RenderSlivers that came before this RenderSliver.
remainingCacheExtent double
Describes how much content the sliver should provide starting from the cacheOrigin.
remainingPaintExtent double
The number of pixels of content that the sliver should consider providing. (Providing more pixels than this is inefficient.)
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
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.
userScrollDirection ScrollDirection
The direction in which the user is attempting to scroll, relative to the axisDirection and growthDirection.
viewportMainAxisExtent double
The number of pixels the viewport can display in the main axis.


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.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed.
toString() String
A string representation of this object.


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