Complete Jetpack Compose Flow Layout Guide

Flow Layouts in Jetpack Compose

FlowRow & FlowColumn create responsive layouts that wrap items automatically. Ideal for chips, tags, filters, grids, and adaptive UI. #JetpackComposeDev

What Are FlowRow & FlowColumn?

Similar to Row/Column but with automatic wrapping when space runs out. Items continue to the next line, making the UI responsive without clipping.

  • Automatic wrap to next row/column
  • Perfect for dynamic chip groups and filters
  • Handles small and large screens easily
  • No manual measurement or calculations needed






Main Axis Arrangement (FlowRow)

Controls how items are placed horizontally before wrapping.

  • Start – Items aligned to the left
  • Center – Items placed in the horizontal center
  • End – Items aligned to the right
  • SpaceBetween – Even spacing between items
  • SpaceAround – Equal spacing around each item
  • SpacedBy(dp) – Fixed gap between items



Cross Axis Arrangement

Controls how each line aligns vertically inside FlowRow.

  • Top – Lines aligned to top
  • Center – Lines centered vertically
  • Bottom – Lines aligned to bottom
  • FlowColumn uses Start / Center / End horizontally


Individual Item Alignment

Align each item within the line independently.

  • Top – Item pinned to upper edge
  • Bottom – Item pinned to lower edge
  • CenterVertically – Centered within the line
  • FlowColumn supports left, right, center alignments

Max Items per Row/Column

Defines how many items fit before wrapping.

  • maxItemsInEachRow – FlowRow control
  • maxItemsInEachColumn – FlowColumn control
  • Default: Unlimited wrapping based on available space
  • Useful for grids (2 per row, 3 per row, etc.)


Weight in Flow Layouts

Weight expands items based on available space, but only within the line they are placed in.

  • Weight is calculated per-line (not whole container)
  • Space is divided among items in the same row/column
  • Ideal for adaptive grids and equal-width items
  • Unused space gets distributed evenly

Building Responsive Grids

FlowRow + weight + maxItems = easy grid without Lazy grids.

  • Make equal-sized boxes
  • Make mixed layouts (wide + narrow items)
  • Automatically adapts to screen size
  • Useful in dashboards, product layouts, cards

Fractional Sizing

Fractional width behaves differently in FlowRow vs Row.

  • FlowRow: fraction applies to full container width
  • Row: fraction applies to remaining space
  • Great for layouts needing sections (70% card + small cards)

Equal Column/Row Sizing

Makes items match the size of the largest item in the same row/column.

  • fillMaxColumnWidth() – Items match full column width
  • fillMaxRowHeight() – Items match tallest item height
  • Useful for consistent list/grid alignment
  • Prevents uneven zig-zag layouts

Where Flow Layouts Shine

Best suited for content that varies in size or screen space.

  • Chips and tag groups
  • Search filters
  • Responsive dashboards
  • Dynamic wrapping lists
  • Adaptive card arrangements

Best Practices

Tips for more predictable Flow layout behavior.

  • Use SpacedBy() for clean spacing
  • Use max items to force consistent line sizes
  • Use weight only when items must expand
  • Use fractional sizing carefully (full container)
  • Combine wrap + weight for adaptive grids

Summary

Flow layouts offer powerful responsive design capabilities without complex measurement logic.

  • Automatic wrapping
  • Flexible spacing & alignment
  • Grid-like arrangement using weight
  • Fractional widths for adaptive UI
  • Perfect for scaling across devices

Thank You - Follow Boltuix

Daily Jetpack Compose content - layouts, Material 3, performance & KMP.

#JetpackCompose #FlowRow #FlowColumn #AndroidDev #Kotlin #AppDadz #Boltuix

Official reference: Flow layouts in Jetpack Compose - this slide pack is a simplified detailed summary.

Post a Comment

Previous Post Next Post