Wrap

Wrap is a widget in Flutter that allows you to display a set of widgets in a horizontal or vertical manner. It automatically wraps the widgets to the next line as needed.

Example

Wrap(
  direction: Axis.horizontal,
  children: [
    Container(height: 50, width: 50, color: Colors.red),
    Container(height: 50, width: 50, color: Colors.green),
    Container(height: 50, width: 50, color: Colors.blue),
    Container(height: 50, width: 50, color: Colors.yellow),
  ],
)

This code will display the four containers in a row. If the screen width is not large enough to display all four containers, it will automatically wrap the remaining containers to the next line.

Attributes