pub struct SliverGeometry {
pub scroll_extent: f64,
pub paint_extent: f64,
pub paint_origin: f64,
pub layout_extent: f64,
pub max_paint_extent: f64,
pub hit_test_extent: f64,
pub visible: bool,
pub has_visual_overflow: bool,
pub scroll_offset_correction: Option<f64>,
pub cache_extent: f64,
}Expand description
What a sliver reports back from layout: how far it scrolls, how much of
the viewport it painted, and where the next sliver starts — Flutter’s
SliverGeometry.
All extents are logical pixels along the constraints’ axis.
Fields§
§scroll_extent: f64The (estimated) total scrollable extent of the sliver’s content
(Flutter’s scrollExtent).
paint_extent: f64How much of the remaining paint extent the sliver painted — its visible
size along the axis (Flutter’s paintExtent).
paint_origin: f64Where the sliver’s first visible pixel sits relative to its layout
position, e.g. negative to paint over an earlier sliver (Flutter’s
paintOrigin).
layout_extent: f64The distance from this sliver’s first visible pixel to the next sliver’s
— usually paint_extent; less for a sliver the next one should overlap
(Flutter’s layoutExtent).
max_paint_extent: f64The (estimated) paint extent the sliver would provide given infinite
remaining paint extent (Flutter’s maxPaintExtent).
hit_test_extent: f64The distance from the paint start to the end of the region that accepts
hits — usually paint_extent (Flutter’s hitTestExtent).
visible: boolWhether the sliver should be painted at all — usually
paint_extent > 0 (Flutter’s visible).
has_visual_overflow: boolWhether the sliver painted outside its paint extent, so the viewport
must clip it (Flutter’s hasVisualOverflow).
scroll_offset_correction: Option<f64>A non-zero amount the viewport must adjust its scroll offset by before
re-running the whole layout, when the sliver found its earlier extent
estimate wrong (Flutter’s scrollOffsetCorrection).
cache_extent: f64How much of the remaining cache extent the sliver consumed — at least
layout_extent (Flutter’s cacheExtent).
Implementations§
Source§impl SliverGeometry
impl SliverGeometry
Sourcepub const ZERO: SliverGeometry
pub const ZERO: SliverGeometry
The geometry of an empty sliver: no extent of any kind and not visible
(Flutter’s SliverGeometry.zero).
Sourcepub fn new(scroll_extent: f64, paint_extent: f64, max_paint_extent: f64) -> Self
pub fn new(scroll_extent: f64, paint_extent: f64, max_paint_extent: f64) -> Self
A geometry with Flutter’s constructor defaults for everything but the
three extents: layout_extent and hit_test_extent equal
paint_extent, cache_extent equals layout_extent, visible is
paint_extent > 0, and the rest is zero.
Sourcepub fn debug_assert_valid(&self, constraints: &SliverConstraints)
pub fn debug_assert_valid(&self, constraints: &SliverConstraints)
Debug-assert the geometry is well formed and fits constraints —
Flutter’s SliverGeometry.debugAssertIsValid plus the paint-extent
check of RenderSliver.debugAssertDoesMeetConstraints.
Checks that scroll_extent, paint_extent, layout_extent,
cache_extent and hit_test_extent are non-negative (NaN fails); that
layout_extent <= paint_extent, paint_extent <= max_paint_extent,
paint_extent <= constraints.remaining_paint_extent and
layout_extent <= cache_extent, each within
PRECISION_ERROR_TOLERANCE; and that a scroll_offset_correction is
finite and non-zero. Compiles to nothing without debug_assertions.