OverflowBar or Wrap?

Flutter tips Published on

When building layouts in Flutter, you often need to place items side-by-side.

Arranging Widgets

Flutter provides several ways to do this. Two useful widgets are OverflowBar and Wrap. They seem similar because they arrange their children, but they handle limited space differently.

What is OverflowBar?

The OverflowBar tries to keep all its children in a single line, usually horizontally. If there isn't enough space, the children will extend beyond the available area.

This is useful when you want to make sure your items are always on one line, even if it means they might not all be visible without scrolling (in a scrollable parent).

What is Wrap?

The Wrap widget also places children next to each other. However, if there isn't enough space on the current line, it will automatically move the next child to a new line.

Think of it like text wrapping in a paragraph. This is great for creating layouts that adjust nicely to different screen sizes or orientations.

The Key Difference

In simple terms:

OverflowBar

Forces children onto one line, even if they overflow.

Wrap

Wraps children onto a new line if space runs out.

Looking at the image examples, the phone in landscape mode clearly shows the effect: OverflowBar keeps the two items on one line (even if the blue one is cut off), while Wrap moves the red item to the next line because there isn't enough width.

Save 3 months of work

Create your app using our 6 years of making Flutter apps and more than 50+ apps

kickstarter for flutter apps

Frequently Asked Questions

What is the main difference between OverflowBar and Wrap?

OverflowBar keeps children on one line and allows them to overflow, while Wrap moves children to a new line if space is limited.

When should I use OverflowBar?

Use OverflowBar when you want items to always stay on a single line, even if they go off-screen, often within a scrollable container.

When should I use Wrap?

Use Wrap when you want items to automatically arrange themselves on multiple lines if they don't fit on one line, making your layout adaptable.

Do OverflowBar and Wrap arrange items vertically or horizontally?

By default, both arrange items horizontally. However, they can also arrange items vertically depending on properties like 'direction' in Wrap or how OverflowBar is used.

Read more
You may also be interested in
Button spam  blog card image
Button spam
Published on 2025-05-12T12:23:21.626Z
Spacing design 8 rule  blog card image
Spacing design 8 rule
Published on 2025-05-12T12:18:48.815Z
ApparenceKit is a flutter template generator tool by Apparence.io © 2025.
All rights reserved