BoxAlignmentGeometry class abstract

Abstract base class for all alignment geometries in flexbox layouts.

This class defines the interface for positioning and sizing flex items within their parent container. It supports various alignment modes including baseline alignment (for text alignment), stretch alignment (to fill available space), and fixed alignments (start, center, end).

Alignment geometries calculate the position and size adjustments needed to place children correctly within the flex container. They work in conjunction with the layout algorithm to determine final item positions.

Subclasses implement specific alignment behaviors:

  • BoxAlignment for absolute positioning
  • DirectionalBoxAlignment for directional (LTR/RTL aware) positioning
  • _StretchBoxAlignment for stretching items to fill space
  • _BaselineBoxAlignment for baseline-based alignment
Implementers

Constructors

BoxAlignmentGeometry.new()
const
BoxAlignmentGeometry.absolute(double value)
Creates an absolute alignment with a custom value. The value represents the absolute position regardless of text direction.
const
factory
BoxAlignmentGeometry.directional(double value)
Creates a directional alignment with a custom value. The value represents the position along the alignment axis.
const
factory

Properties

hashCode int
The hash code for this object.
no setterinherited
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}) double?
Optionally adjusts the size of the child during alignment.
align({required ParentLayout parent, required LayoutAxis axis, required double viewportSize, required double contentSize, required double maxBaseline, required double childBaseline}) double
Calculates the alignment position for a child within its parent container.
needsBaseline({required ParentLayout parent, required LayoutAxis axis}) bool
Determines if this alignment requires baseline information.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Constants

baseline → const BoxAlignmentGeometry
Aligns items based on their baseline (typically for text alignment).
center → const BoxAlignmentGeometry
Centers items within the container.
end → const BoxAlignmentGeometry
Aligns items to the end of the container (right for horizontal, bottom for vertical).
start → const BoxAlignmentGeometry
Aligns items to the start of the container (left for horizontal, top for vertical).
stretch → const BoxAlignmentGeometry
Creates a directional alignment with the specified value. Values typically range from -1.0 (start) to 1.0 (end), with 0.0 being center.