mainAxisSpacing
MainAxisSpacing is a layout property used in grid-based or flex-like UI constructs to define the space between items along the grid’s main axis. In Flutter, it is commonly associated with grid delegates such as SliverGridDelegateWithFixedCrossAxisCount and SliverGridDelegateWithMaxCrossAxisExtent, where it controls the vertical or horizontal gap between adjacent rows, depending on the grid’s scrolling direction.
In practical terms, mainAxisSpacing adds breathing room between grid items along the main axis. When the grid
Default values typically set mainAxisSpacing to 0.0, meaning no extra space beyond the item sizes. Setting a
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
)
See also: crossAxisSpacing, childAspectRatio, SliverGridDelegate, GridView.