Building Responsive UI in Flutter for All Devices.


Have you ever built a Flutter app that looked amazing on your phone, but then… you opened it on a tablet or a browser, and suddenly everything looked off? Texts were overlapping, buttons were flying around, and your layout just didn’t fit anymore?
Yeah, we’ve all been there.
Welcome to the world of responsive design — where the same app needs to adapt gracefully to every screen size, from tiny phones to giant desktop monitors.
The good news? Flutter actually makes this easier than you’d expect. Let me show you how.
Why You Need Responsive UI
We love Flutter because it’s cross-platform. One codebase for Android, iOS, web, desktop — that’s the dream. But if your UI is hardcoded for one screen size, the dream quickly becomes a nightmare.
Today’s users expect apps to just work — whether they’re using a foldable phone, an iPad, or resizing a browser window on a desktop. And trust me, nothing screams "unfinished" like an app where elements overflow or vanish on larger screens.
Flutter Tools for Responsive Design
Flutter gives us some awesome tools right out of the box. Here are the MVPs:
1. MediaQuery
Use it to get the screen’s width and height dynamically.
dartCopyEditfinal width = MediaQuery.of(context).size.width;
Great for adjusting padding, font sizes, or layout decisions based on available space.
2. LayoutBuilder
This is a game-changer. It gives you the constraints of the parent widget so you can build adaptive layouts.
dartCopyEditLayoutBuilder(
builder: (context, constraints) {
if (constraints.maxWidth < 600) {
return MobileLayout();
} else {
return TabletLayout();
}
},
)
Think of it like: “If I have more space, show more content.”
3. Flexible & Expanded
Use these inside Row and Column to avoid hardcoding widths and heights. Let your widgets stretch and shrink based on available space.
4. Wrap
This is perfect when items (like buttons or chips) overflow in one row. Instead of breaking the layout, Wrap
flows them to the next line.
5. AspectRatio
Need to maintain a consistent layout ratio? This widget ensures your container scales properly on any screen.
📐 Think in Breakpoints (Just Like Web Devs)
One practical way to plan layouts is by setting breakpoints:
Screen Width | Layout Type |
< 600 | Mobile Layout |
600 - 1200 | Tablet Layout |
> 1200 | Desktop/Web Layout |
You can apply this logic inside your LayoutBuilder
to switch between views.
Example: Responsive Dashboard Layout
Here’s a simple way to load different layouts depending on screen size:
dartCopyEditWidget build(BuildContext context) {
return LayoutBuilder(
builder: (context, constraints) {
if (constraints.maxWidth < 600) {
return SingleColumnLayout();
} else if (constraints.maxWidth < 1200) {
return TwoColumnLayout();
} else {
return ThreeColumnLayout();
}
},
);
}
Now, each layout (SingleColumnLayout
, etc.) can be customized for its screen size.
Helpful Packages for Responsive Design
Want to make things easier? These packages can help:
flutter_screenutil
– Makes your UI scale based on screen size (great for padding, font sizes, etc.)responsive_builder
– Offers simple breakpoints and builder widgets.sizer
– Use percentages for width/height instead of hardcoded pixels.
🔍 Don’t Forget to Test Responsiveness
Before shipping, test your app on:
Different devices (phones, tablets, emulators)
Portrait & landscape
Flutter Web in a resizable browser
Large fonts / accessibility settings
Tools like Flutter DevTools and Device Preview are super helpful.
Final Thoughts
In today’s multi-device world, a responsive UI is no longer optional — it’s expected.
Fortunately, Flutter gives us the tools to handle it smartly. With a little planning and the right widgets, you can build apps that look and feel great everywhere — without maintaining multiple codebases.
So next time you start a Flutter project, don’t just think “phone.” Think big. Think wide. Think responsive.
Subscribe to my newsletter
Read articles from Ajay Bhanderi directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by

Ajay Bhanderi
Ajay Bhanderi
My self Ajay Bhanderi,I am a Software Engineer. a highly motivated and enthusiastic individual with a strong passion for technology and innovation.