Flow

public struct Flow : Element

Element which lays out children horizontally, wrapping to another row when there is not enough space.

You may control the layout of each row within the flow layout, by providing a LineAlignment, which controls the horizontal alignment of content within a row when it is smaller than its container, and via ItemAlignment, which controls the vertical alignment of shorter elements within a row.

Flow(itemSpacing: 10, lineSpacing: 10) {
    OnboardingPill("Food / drink")
    OnboardingPill("Retail goods").flowChild(key: "aKey")
    OnboardingPill("Grocery / gourmet / alcohol")
    OnboardingPill("Beauty / wellness bookings")
    OnboardingPill("Healthcare services")
    OnboardingPill("Something else")
}

Below is a diagram showing a simple example of a Flow layout.

┌─────────────────────────────────────┐
 ┌─────────┐┌─────────┐┌────────────┐│
     1    ││    2    ││     3      ││
 └─────────┘└─────────┘└────────────┘│
 ┌───────┐┌─────┐┌───────────┐       
    4   ││  5  ││     6            
 └───────┘└─────┘└───────────┘       
└─────────────────────────────────────┘

Element