Skip to content

Align Self

Use self-* utilities to override an individual item’s cross-axis alignment, ignoring the container’s items-* value.

Use self-start to align an individual item against the start of the container’s cross axis.

Style('flex items-stretch ...', children: [
Text('01'),
Style('self-start ...', child: Text('02')),
Text('03'),
])

Use self-center to align an individual item along the center of the container’s cross axis.

Style('flex items-stretch ...', children: [
Text('01'),
Style('self-center ...', child: Text('02')),
Text('03'),
])

Use self-end to align an individual item against the end of the container’s cross axis.

Style('flex items-stretch ...', children: [
Text('01'),
Style('self-end ...', child: Text('02')),
Text('03'),
])

Use self-auto to revert to the value of the container’s items-* setting (CSS default). The override is a no-op — the child inherits whatever the container declares.

Style('flex items-stretch ...', children: [
Text('01'),
Style('self-auto ...', child: Text('02')),
Text('03'),
])

Use self-stretch to opt an individual item into the parent’s items-stretch behavior. When the parent already stretches all children, the override is visually identical to the surrounding tiles.

Style('flex items-stretch ...', children: [
Text('01'),
Style('self-stretch ...', child: Text('02')),
Text('03'),
])

Use self-baseline to align items by the alphabetic baseline of their first text run. When EVERY direct flex child carries self-baseline (and the container has no items-*), the renderer promotes the parent’s crossAxisAlignment to CrossAxisAlignment.baseline. Asymmetric pt-* / pb-* make the shared baseline visible across tiles of varying intrinsic heights.

Style('flex ...', children: [
Style('self-baseline pt-2 pb-6', child: Text('01')),
Style('self-baseline pt-8 pb-12', child: Text('02')),
Style('self-baseline pt-12 pb-4', child: Text('03')),
])
ClassDescription
self-autoDefer to the parent’s items-* value (CSS default).
self-startAlign this item to the start of the cross axis.
self-centerAlign this item to the center of the cross axis.
self-endAlign this item to the end of the cross axis.
self-stretchStretch this item to fill the cross axis.
self-baselineAlign this item by its first text-run baseline (all-children opt-in).
self-baseline-last(parity omitted)
self-center-safe, self-end-safe(parity omitted)
  • self-baseline-last — Flutter has no last-baseline concept; the dominant baseline is always the first text baseline of each child.
  • self-center-safe, self-end-safe — the CSS safe keyword falls back to start when an item would overflow; Flutter’s layout has no overflow-fallback alignment concept.
  • Mixed self-baseline — Flutter’s RenderFlex applies a single CrossAxisAlignment to all children of a Row/Column, so the renderer can only promote when EVERY direct child carries self-baseline. If only some children opt in, the class is parsed but has no visual effect (the parent’s items-* wins). Implementing the mixed case would require a custom RenderFlex and is out of scope.