BoxAlignmentSpacing class

Spacing-based box alignment for distributing items with gaps.

BoxAlignmentSpacing controls how items are distributed within a container by specifying spacing ratios at the start and end. This enables layouts like space-between, space-around, and space-evenly.

The aroundStart and aroundEnd values determine how much space is added before the first item and after the last item relative to the space between items. For example, space-around uses 0.5 for both, while space-evenly uses 1.0.

See also:

Inheritance

Constructors

BoxAlignmentSpacing(double aroundStart, double aroundEnd)
Creates an even spacing alignment with custom start and end ratios.
const
BoxAlignmentSpacing.around()
Creates space-around alignment: equal space around each item.
const
BoxAlignmentSpacing.aroundSymmetric(double ratio)
Creates symmetric space-around with a custom ratio.
const
BoxAlignmentSpacing.between()
Creates space-between alignment: equal space between items, no space at edges.
const
BoxAlignmentSpacing.even()
Creates space-evenly alignment: equal space between and around all items.
const

Properties

aroundEnd → double
The spacing ratio at the end (after last item).
final
aroundStart → double
The spacing ratio at the start (before first item).
final
hashCode → int
The hash code for this object.
no setteroverride
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

adjustSize({required ParentLayout parent, required LayoutAxis axis, required double viewportSize, required double contentSize, required double childSize}) → double?
Optionally adjusts the size of the child during alignment.
inherited
adjustSpacing({required ParentLayout parent, required LayoutAxis axis, required double viewportSize, required double contentSize, required double startSpacing, required double spacing, required double endSpacing, required int affectedCount}) → ({double additionalEndSpacing, double additionalSpacing, double additionalStartSpacing})?
Calculates additional spacing to distribute remaining space evenly.
override
align({required ParentLayout parent, required LayoutAxis axis, required double viewportSize, required double contentSize, required double maxBaseline, required double childBaseline}) → double
Even spacing alignments position items at their natural positions (offset 0). The spacing adjustments are handled by adjustSpacing.
override
needsBaseline({required ParentLayout parent, required LayoutAxis axis}) → bool
This alignment never requires baseline information since it doesn't support baseline alignment.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
override

Operators

operator ==(Object other) → bool
The equality operator.
override