pub trait SliverGridLayout: Debug {
// Required methods
fn get_min_child_index_for_scroll_offset(&self, scroll_offset: f64) -> i32;
fn get_max_child_index_for_scroll_offset(&self, scroll_offset: f64) -> i32;
fn get_geometry_for_child_index(&self, index: i32) -> SliverGridGeometry;
fn compute_max_scroll_offset(&self, child_count: i32) -> f64;
}Expand description
The size and position of all the tiles in a RenderSliverGrid.
Rather that providing a grid with a SliverGridLayout directly, the grid is provided a
SliverGridDelegate, which computes a SliverGridLayout given a set of
SliverConstraints. This allows the algorithm to dynamically respond to changes in the
environment (e.g. the user rotating the device).
The tiles can be placed arbitrarily, but it is more efficient to place tiles roughly in order by scroll offset because grids reify a contiguous sequence of children.
See also:
SliverGridRegularTileLayout, which represents a layout that uses equally sized and spaced tiles.SliverGridGeometry, which represents the size and position of a single tile in a grid.SliverGridDelegate::get_layout, which returns this object to describe the delegate’s layout.RenderSliverGrid, which uses this class during itsperform_layoutmethod.
Required Methods§
Sourcefn get_min_child_index_for_scroll_offset(&self, scroll_offset: f64) -> i32
fn get_min_child_index_for_scroll_offset(&self, scroll_offset: f64) -> i32
The minimum child index that intersects with (or is after) this scroll offset.
Sourcefn get_max_child_index_for_scroll_offset(&self, scroll_offset: f64) -> i32
fn get_max_child_index_for_scroll_offset(&self, scroll_offset: f64) -> i32
The maximum child index that intersects with (or is before) this scroll offset.
Sourcefn get_geometry_for_child_index(&self, index: i32) -> SliverGridGeometry
fn get_geometry_for_child_index(&self, index: i32) -> SliverGridGeometry
The size and position of the child with the given index.
Sourcefn compute_max_scroll_offset(&self, child_count: i32) -> f64
fn compute_max_scroll_offset(&self, child_count: i32) -> f64
The scroll extent needed to fully display all the tiles if there are child_count
children in total.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".