Wrap

The Wrap widget is a layout widget that arranges its children in a horizontal or vertical sequence, and automatically wraps them to the next line if there isn't enough space. This is useful for creating flexible layouts that adapt to different screen sizes.

Properties

Property
Description

direction

The direction in which to lay out the children (horizontal or vertical).

wrapAlignment

How the children within a single run (line) should be aligned along the main axis.

runAlignment

How the runs themselves should be aligned along the cross axis.

wrapCrossAlignment

How the children within a run should be aligned along the cross axis.

verticalDirection

The direction in which to lay out the children vertically (up or down).

spacing

The amount of space between children in the main axis.

runSpacing

The amount of space between runs in the cross axis.

clipBehavior

How to clip the content of the wrap widget.

dataSource

A list of data that can be used to dynamically generate children widgets.


Default Properties

The Wrap widget supports all three sections of default properties:

Layout

  • width

  • height

  • padding

  • margin

  • align

Appearance

  • bgColor

  • borderRadius

  • border

    • borderWidth

    • borderColor

    • borderType (e.g., solid, dashed)

    • strokeAlign

Interactions

  • onClick — Used to add actions to the Wrap widget.

Last updated