pub struct SliverGridGeometry {
pub scroll_offset: f64,
pub cross_axis_offset: f64,
pub main_axis_extent: f64,
pub cross_axis_extent: f64,
}Expand description
Describes the placement of a child in a RenderSliverGrid.
This class is similar to Rect, in that it gives a two-dimensional
position and a two-dimensional dimension, but is direction-agnostic.
See also:
SliverGridLayout, which represents the geometry of all the tiles in a grid.SliverGridLayout::get_geometry_for_child_index, which returns this object to describe the child’s placement.RenderSliverGrid, which uses this class during itsperform_layoutmethod.
Fields§
§scroll_offset: f64The scroll offset of the leading edge of the child relative to the leading edge of the parent.
cross_axis_offset: f64The offset of the child in the non-scrolling axis.
If the scroll axis is vertical, this offset is from the left-most edge of the parent to the left-most edge of the child. If the scroll axis is horizontal, this offset is from the top-most edge of the parent to the top-most edge of the child.
main_axis_extent: f64The extent of the child in the scrolling axis.
If the scroll axis is vertical, this extent is the child’s height. If the scroll axis is horizontal, this extent is the child’s width.
cross_axis_extent: f64The extent of the child in the non-scrolling axis.
If the scroll axis is vertical, this extent is the child’s width. If the scroll axis is horizontal, this extent is the child’s height.
Implementations§
Source§impl SliverGridGeometry
impl SliverGridGeometry
Sourcepub const fn new(
scroll_offset: f64,
cross_axis_offset: f64,
main_axis_extent: f64,
cross_axis_extent: f64,
) -> SliverGridGeometry
pub const fn new( scroll_offset: f64, cross_axis_offset: f64, main_axis_extent: f64, cross_axis_extent: f64, ) -> SliverGridGeometry
Creates an object that describes the placement of a child in a RenderSliverGrid.
Sourcepub fn trailing_scroll_offset(&self) -> f64
pub fn trailing_scroll_offset(&self) -> f64
The scroll offset of the trailing edge of the child relative to the leading edge of the parent.
Sourcepub fn get_box_constraints(
&self,
constraints: SliverConstraints,
) -> BoxConstraints
pub fn get_box_constraints( &self, constraints: SliverConstraints, ) -> BoxConstraints
Returns a tight BoxConstraints that forces the child to have the required size, given
a SliverConstraints.