Flex

This widget motivated by Flex in Flutter.

A widget that displays its children in a one-dimensional array.

The Flex widget allows you to control the axis along which the children are placed (horizontal or vertical). This is referred to as the main axis. If you know the main axis in advance, then consider using a Row (if it’s horizontal) or Column (if it’s vertical) instead, because that will be less verbose.

To cause a child to expand to fill the available space in the direction of this widget’s main axis, wrap the child in an Expanded widget.

The Flex widget does not scroll (and in general it is considered an error to have more children in a Flex than will fit in the available room). If you have some widgets and want them to be able to scroll if there is insufficient room, consider using a ListView.

The Flex widget does not allow its children to wrap across multiple horizontal or vertical runs. For a widget that allows its children to wrap, consider using the Wrap widget instead of Flex.

If you only have one child, then rather than using Flex, Row, or Column, consider using Align or Center to position the child.

See: https://api.flutter.dev/flutter/widgets/Flex-class.html

Props

direction

Value: Axis

mainAxisAlignment

Value: mainAxisAlignment (default: MainAxisAlignment.start)

crossAxisAlignment

Value: crossAxisAlignment (default: CainAxisAlignment.center)

verticalDirection

Value: verticalDirection (default: VerticalDirection.down)

clipped

Value: boolean (default: false)

children

Value: Widget[]

Examples

Basic