Skip to main content

SliverGridDelegate

Trait SliverGridDelegate 

Source
pub trait SliverGridDelegate: Debug {
    // Required methods
    fn get_layout(
        &self,
        constraints: SliverConstraints,
    ) -> Box<dyn SliverGridLayout>;
    fn should_relayout(&self, old_delegate: &dyn SliverGridDelegate) -> bool;
    fn as_any(&self) -> &dyn Any;
}
Expand description

Controls the layout of tiles in a grid.

Given the current constraints on the grid, a SliverGridDelegate computes the layout for the tiles in the grid. 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_layout( &self, constraints: SliverConstraints, ) -> Box<dyn SliverGridLayout>

Returns information about the size and position of the tiles in the grid.

Source

fn should_relayout(&self, old_delegate: &dyn SliverGridDelegate) -> bool

Override this method to return true when the children need to be laid out.

This should compare the fields of the current delegate and the given old_delegate and return true if the fields are such that the layout would be different. The grid asks only for an old_delegate of this delegate’s own type.

Source

fn as_any(&self) -> &dyn Any

Downcast support for Dart’s runtimeType comparison and covariant parameters.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§