Sign in
Last updated
Aug 28, 2025
8 mins read
Share on
Shape modern UI faster with the right AI tool
Software Development Executive - I
Writes code, blogs, and product docs. She loves a good meal, a great playlist, and a clean commit history. When she’s not debugging, she’s probably experimenting with a new recipe.
Software Development Executive - I
Innovative Flutter developer & software engineer turning creative visions into sleek mobile experiences. He thrives on clean code, intuitive design, and pushing digital boundaries—one app at a time.
Learn how to style Flutter apps with smooth rounded corners using the BorderRadius property. This guide covers containers, cards, and navigation bars, along with practical examples, best practices, and clean design tips for modern UI development.
A clean user interface can make the difference between an app that feels outdated and one that feels modern. Rounded corners play a big role in creating that polished look. In Flutter, this is handled with the borderRadius
property, which lets you style containers, cards, and navigation bars with smooth edges.
This guide walks you through how to set border radius, customize corners, and apply it across different widgets to bring a refined touch to your Flutter application.
The BorderRadius
the property helps shape widgets by softening sharp edges into radii
. Whether you’re working with a Container, Card, or navigation bar, you can set border radius values to match your design needs. Developers often apply this styling through the decoration property inside the container widget using the BoxDecoration
class.
Rounded corners not only enhance visual consistency but also help align mobile apps with material design principles. Let’s look into how this works step by step.
A container widget is the most common element where you apply a border. By combining it with the decoration argument, you can control border width, border color, and radius.
1import 'package:flutter/material.dart'; 2 3void main() { 4 runApp(const MyStatefulWidget()); 5} 6 7class MyStatefulWidget extends StatefulWidget { 8 const MyStatefulWidget({Key? key}) : super(key: key); 9 10 11 State<MyStatefulWidget> createState() => _MyStatefulWidgetState(); 12} 13 14class _MyStatefulWidgetState extends State<MyStatefulWidget> { 15 16 Widget build(BuildContext context) { 17 return MaterialApp( 18 home: Scaffold( 19 body: Center( 20 child: Container( 21 width: 200, 22 padding: const EdgeInsets.all(20), 23 decoration: const BoxDecoration( 24 color: Colors.blue, 25 borderRadius: BorderRadius.all(Radius.circular(20)), 26 border: Border.fromBorderSide( 27 BorderSide(color: Colors.black, width: 2), 28 ), 29 ), 30 child: const Text("Rounded Container"), 31 ), 32 ), 33 ), 34 ); 35 } 36} 37
This code snippet applies a container border radius using the const BoxDecoration. The radius is controlled with BorderRadius.all(Radius.circular(20))
.
While a container is the common case, other widgets also support border radius. For example, Card, ClipRRect, and navigation bars often require rounded corners.
When creating a navigation bar, you can set the border radius at the top or bottom edges by specifying BorderRadius.only(topLeft: Radius.circular(16)
, topRight: Radius.circular(16))
.
Sometimes you don’t want all corners styled the same. The BorderRadius.only
The constructor lets you control the top left, top right, bottom left, and bottom right individually.
1Container( 2 decoration: const BoxDecoration( 3 color: Colors.white, 4 borderRadius: BorderRadius.only( 5 topLeft: Radius.circular(25), 6 bottomRight: Radius.circular(15), 7 ), 8 ), 9 child: const Text("Custom Corners"), 10) 11
This creates a container with only two rounded corners. You can control each edge individually for precision styling.
Here’s a Mermaid chart describing BorderRadius with Container and other widgets. I’ve avoided function-style descriptions and kept it conceptual so it reads like a flow of ideas:
BorderRadius
applies mainly on Container widget
through the decoration property
.BoxDecoration
, you manage border width, border color, and radius.all
, only
, and circular
.Card
, ClipRRect
, and Navigation Bar
also support radius.Rounded edges play different roles depending on the widget type. Here are some practical examples:
You cannot apply a radius directly to a Column. Instead, wrap the column inside a Container and use the decoration property. This way, you can set border radius while still maintaining your column layout.
To give a container a circular shape, set equal width and height values while applying BoxDecoration(shape: [BoxShape.circle](http://boxshape.circle/))
. This ignores the borderRadius
property but produces a perfectly rounded UI element.
Navigation bars often look better with rounded top corners. Using BorderRadius.vertical(top: Radius.circular(20))
creates a soft transition into your main body.
To add a border to a container, use the border property within BoxDecoration
. Combine Border.all(color: [Colors.black](http://colors.black/), width: 3)
with borderRadius
to create both shape and edge styling.
Cards in Flutter already have a radius applied by default. If you want to override, wrap them with a container or directly set the radius in the Card widget using its shape property.
Looking for faster ways to build and refine Flutter UI with modern styling? Try Rocket.new to speed up your development workflow and keep your designs consistent.
Working with borders and radii often means balancing width, color property, and consistent design language. In larger apps, you can extract these values into theme definitions, making them reusable across multiple widgets.
1class MyStatefulWidget extends StatelessWidget { 2 const MyStatefulWidget({Key? key}) : super(key: key); 3 4 5 Widget build(BuildContext context) { 6 return MaterialApp( 7 home: Scaffold( 8 body: Center( 9 child: Wrap( 10 children: [ 11 Container( 12 width: 120, 13 padding: const EdgeInsets.all(10), 14 decoration: const BoxDecoration( 15 color: Colors.green, 16 borderRadius: BorderRadius.all(Radius.circular(12)), 17 border: Border.fromBorderSide(BorderSide(width: 2)), 18 ), 19 child: const Text("Box 1"), 20 ), 21 const SizedBox(width: 20), 22 Container( 23 width: 120, 24 padding: const EdgeInsets.all(10), 25 decoration: const BoxDecoration( 26 color: Colors.orange, 27 borderRadius: BorderRadius.all(Radius.circular(8)), 28 ), 29 child: const Text("Box 2"), 30 ), 31 ], 32 ), 33 ), 34 ), 35 ); 36 } 37} 38
This example demonstrates how you can style multiple container widgets with different radii
values while keeping consistency across the application.
const
keyword wherever possible for improved performanceIn Flutter, marking objects as const
tells the framework that the widget or property will never change. For example, writing const BoxDecoration(...)
ensures Flutter can compile it at build time instead of recreating it during every frame.
This small optimization reduces rebuild costs, especially when you’re working with multiple container widgets
styled with border radius. Always apply const
when the values of color
, borderRadius
, or border
remain fixed.
BorderRadius.circular(value)
for uniform styling across all cornersWhen you want all corners to have the same radius, use BorderRadius.circular(20)
instead of BorderRadius.all(Radius.circular(20))
.
It is shorter, cleaner, and communicates intent clearly. Uniform radii also give your UI a consistent look, which is important when designing buttons, cards, or navigation bars. Developers should reserve BorderRadius.only
for cases where specific corners need customization.
A rounded container
looks better when the child
Inside has balanced padding. Without it, text or icons can touch the edges of the border and appear cramped.
Using const EdgeInsets.all(value)
or EdgeInsets.symmetric(horizontal, vertical)
ensures that the inner content respects the border shape. Consistency in padding also improves readability and maintains visual hierarchy across different widgets in the app.
If you find yourself applying the same container border radius
, border color
, and decoration property
across multiple widgets, extract them into a reusable widget or theme file.
For example, you could create a RoundedBox
class that wraps a container
with predefined styling. This approach not only avoids repetition but also makes it easier to update the design system in one place when design guidelines change.
A radius that looks perfect on a small phone might appear too subtle or exaggerated on a large tablet. Always preview your Flutter application across different devices, orientations, and screen densities.
You can use Flutter’s built-in device preview tools or simulators to check consistency. This step ensures that your chosen radii, border widths, and layouts scale gracefully without breaking the user experience.
Want to see how inner and outer border radius values can affect design balance?
👉 Check out this detailed post on fixing uneven rounded corners for cleaner layouts.
Rounded edges and borders are subtle but impactful details in Flutter applications. By applying the container border radius effectively, you can refine navigation bars, cards, and containers while maintaining consistent layouts.
Whether you’re working with a small widget or a full-screen layout, the techniques shared in this blog help you create flexible and modern designs. The Flutter BorderRadius is a simple yet powerful way to make your apps visually appealing.
Q1. How do you do a border radius in Flutter?
Use the decoration property inside a container widget with BoxDecoration and the borderRadius property. Example: BorderRadius.circular(10).
Q2. What is the default border radius in Flutter?
By default, most widgets have sharp corners. Some widgets, like Card, apply a small default radius (usually 4.0).
Q3. How do you round the border of a container in Flutter?
Wrap your content inside a container, apply decoration, and set borderRadius using Radius.circular(value).
Q4. How do you give a border radius to a navigation bar in Flutter?
Use BorderRadius.vertical(top: Radius.circular(20)) in the decoration of a container wrapping the navigation bar.