Flex constructor

  1. {Key key,
  2. @required Axis direction,
  3. MainAxisAlignment mainAxisAlignment: MainAxisAlignment.start,
  4. MainAxisSize mainAxisSize: MainAxisSize.max,
  5. CrossAxisAlignment crossAxisAlignment: CrossAxisAlignment.center,
  6. TextDirection textDirection,
  7. VerticalDirection verticalDirection: VerticalDirection.down,
  8. TextBaseline textBaseline,
  9. Clip clipBehavior: Clip.hardEdge,
  10. List<Widget> children: const []}

Creates a flex layout.

The direction is required.

The direction, mainAxisAlignment, crossAxisAlignment, and verticalDirection arguments must not be null. If crossAxisAlignment is CrossAxisAlignment.baseline, then textBaseline must not be null.

The textDirection argument defaults to the ambient Directionality, if any. If there is no ambient directionality, and a text direction is going to be necessary to decide which direction to lay the children in or to disambiguate start or end values for the main or cross axis directions, the textDirection must not be null.


  Key key,
  @required this.direction,
  this.mainAxisAlignment = MainAxisAlignment.start,
  this.mainAxisSize = MainAxisSize.max,
  this.crossAxisAlignment = CrossAxisAlignment.center,
  this.verticalDirection = VerticalDirection.down,
  this.clipBehavior = Clip.hardEdge,
  List<Widget> children = const <Widget>[],
}) : assert(direction != null),
     assert(mainAxisAlignment != null),
     assert(mainAxisSize != null),
     assert(crossAxisAlignment != null),
     assert(verticalDirection != null),
     assert(crossAxisAlignment != CrossAxisAlignment.baseline || textBaseline != null),
     assert(clipBehavior != null),
     super(key: key, children: children);