Skip to main content

SliverGridLayout

Trait SliverGridLayout 

Source
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:

Required Methods§

Source

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.

Source

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.

Source

fn get_geometry_for_child_index(&self, index: i32) -> SliverGridGeometry

The size and position of the child with the given index.

Source

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".

Implementors§