Skip to content

Spacer

A flexible empty gap along the main axis of a Row or Column.

See also: Expanded to give the space to a child · Flexible for a child that may take less.

Learn more: Layout

Import: package:fleury/fleury.dart, or package:fleury/fleury_core.dart in browser code.

Row(children: [
Text('left'),
const Spacer(),
Text('right'),
])

A Spacer() between two children pushes them to opposite ends; Spacer(flex: 2) takes twice the share of another Spacer. It is shorthand for Expanded(flex: flex, child: const SizedBox.shrink()).

ParameterTypeDefaultDescription
flex:int1This spacer’s share of the remaining main-axis space, relative to other flex children.

Spacer is defined in packages/fleury/lib/src/widgets/basic.dart.

Category: Layout · All widgets