pub struct SliverGridDelegateWithMaxCrossAxisExtent {
pub max_cross_axis_extent: f64,
pub main_axis_spacing: f64,
pub cross_axis_spacing: f64,
pub child_aspect_ratio: f64,
pub main_axis_extent: Option<f64>,
}Expand description
Creates grid layouts with tiles that each have a maximum cross-axis extent.
This delegate will select a cross-axis extent for the tiles that is as large as possible subject to the following conditions:
- The extent evenly divides the cross-axis extent of the grid.
- The extent is at most
max_cross_axis_extent.
For example, if the grid is vertical, the grid is 500.0 pixels wide, and
max_cross_axis_extent is 150.0, this delegate will create a grid with 4 columns that are
125.0 pixels wide.
This delegate creates grids with equally sized and spaced tiles.
Dart’s named constructor arguments are the fluent setters.
See also:
SliverGridDelegateWithFixedCrossAxisCount, which creates a layout with a fixed number of tiles in the cross axis.SliverGridDelegate, which creates arbitrary layouts.RenderSliverGrid, which can use this delegate to control the layout of its tiles.
Fields§
§max_cross_axis_extent: f64The maximum extent of tiles in the cross axis.
main_axis_spacing: f64The number of logical pixels between each child along the main axis.
cross_axis_spacing: f64The number of logical pixels between each child along the cross axis.
child_aspect_ratio: f64The ratio of the cross-axis to the main-axis extent of each child.
main_axis_extent: Option<f64>The extent of each tile in the main axis. If provided it would define the logical pixels taken by each tile in the main-axis.
If None, child_aspect_ratio is used instead.
Implementations§
Source§impl SliverGridDelegateWithMaxCrossAxisExtent
impl SliverGridDelegateWithMaxCrossAxisExtent
Sourcepub fn new(
max_cross_axis_extent: f64,
) -> SliverGridDelegateWithMaxCrossAxisExtent
pub fn new( max_cross_axis_extent: f64, ) -> SliverGridDelegateWithMaxCrossAxisExtent
Creates a delegate that makes grid layouts with tiles that have a maximum cross-axis extent.
The max_cross_axis_extent must be greater than zero.
Sourcepub fn main_axis_spacing(self, value: f64) -> Self
pub fn main_axis_spacing(self, value: f64) -> Self
Dart SliverGridDelegateWithMaxCrossAxisExtent(mainAxisSpacing:). Must not be negative.
Sourcepub fn cross_axis_spacing(self, value: f64) -> Self
pub fn cross_axis_spacing(self, value: f64) -> Self
Dart SliverGridDelegateWithMaxCrossAxisExtent(crossAxisSpacing:). Must not be negative.
Sourcepub fn child_aspect_ratio(self, value: f64) -> Self
pub fn child_aspect_ratio(self, value: f64) -> Self
Dart SliverGridDelegateWithMaxCrossAxisExtent(childAspectRatio:). Must be greater than
zero.
Sourcepub fn main_axis_extent(self, value: f64) -> Self
pub fn main_axis_extent(self, value: f64) -> Self
Dart SliverGridDelegateWithMaxCrossAxisExtent(mainAxisExtent:). Must not be negative.