Skip to content

Justify Content

Use justify-* utilities to control how flex and grid items are positioned along the container’s main axis.

Use justify-start to pack items against the start of the container’s main axis.

Style('flex justify-start ...', children: [
Text('01'),
Text('02'),
Text('03'),
])

Use justify-center to pack items along the center of the container’s main axis.

Style('flex justify-center ...', children: [
Text('01'),
Text('02'),
Text('03'),
Text('04'),
])
Style('flex justify-center-safe ...', children: [
Text('01'),
Text('02'),
Text('03'),
Text('04'),
])

Use justify-end to pack items against the end of the container’s main axis.

Style('flex justify-end ...', children: [
Text('01'),
Text('02'),
Text('03'),
Text('03'),
])
Style('flex justify-end-safe ...', children: [
Text('01'),
Text('02'),
Text('03'),
Text('03'),
])

Use justify-between to distribute items so the first sits at the start, the last sits at the end, and the remaining space is split evenly between them.

Style('flex justify-between ...', children: [
Text('01'),
Text('02'),
Text('03'),
])

Use justify-around to distribute items along the main axis with equal space around each one.

Style('flex justify-around ...', children: [
Text('01'),
Text('02'),
Text('03'),
])

Use justify-evenly to distribute items along the main axis so the gaps between them — and between the first/last item and the container edge — are all equal.

Style('flex justify-evenly ...', children: [
Text('01'),
Text('02'),
Text('03'),
])
ClassDescription
justify-startPack items against the start of the main axis.
justify-centerPack items along the center of the main axis.
justify-endPack items against the end of the main axis.
justify-betweenDistribute items evenly; first item at start, last at end.
justify-aroundDistribute items evenly with equal space around each.
justify-evenlyDistribute items with equal space between each and the container edges.
justify-stretch(parity omitted)
justify-normal(parity omitted)
justify-baseline(parity omitted)
justify-center-safe, justify-end-safe(parity omitted)
  • justify-stretch, justify-normal, justify-baseline — Flutter’s MainAxisAlignment has no stretch / normal / baseline value, so these have no equivalent in the flex renderer.
  • justify-center-safe, justify-end-safe — the CSS safe keyword falls back to start when items would overflow the container; Flutter’s layout has no overflow-fallback alignment concept.