How to Add Rounded Borders to a Flutter Container

How to Add Rounded Borders to a Container in Flutter

11 May 2026 Stephan Petzl Leave a comment Tech-Help

If you want a Container with a border and rounded corners in Flutter, the key is to use borderRadius inside BoxDecoration. A common mistake is to try clipping the widget after adding the border, which can remove or hide the border instead of rounding it cleanly.

The simplest solution

For most cases, you can keep your Container and add both border and borderRadius in the decoration:

Container(
  width: screenWidth / 7,
  decoration: BoxDecoration(
    border: Border.all(
      color: Colors.red,
    ),
    borderRadius: BorderRadius.circular(20),
  ),
  child: Padding(
    padding: const EdgeInsets.all(5.0),
    child: Column(
      children: [
        Text(
          '6',
          style: TextStyle(
            color: Colors.red,
            fontSize: 25,
          ),
        ),
        Text(
          'sep',
          style: TextStyle(
            color: Colors.red,
          ),
        )
      ],
    ),
  ),
);

This is usually the best approach when you want a standard rounded rectangle.

Why ClipRRect may not be the right choice

ClipRRect is useful when you want to clip the child content to rounded corners, but it is not the best tool if your goal is to preserve a visible border. In many layouts, clipping can make the border look cut off or disappear at the edges.

In other words:

  • Use BoxDecoration when you want rounded borders on the container itself.
  • Use ClipRRect when you want to clip the child content, such as an image or background, to a rounded shape.

When to use a circle instead

If your design needs a fully circular element, use shape: BoxShape.circle:

Container(
  decoration: BoxDecoration(
    shape: BoxShape.circle,
    color: Colors.black,
  ),
  child: const Icon(
    Icons.add,
    color: Colors.white,
  ),
);

This works well for icon buttons, badges, and circular counters.

Rounding only specific corners

Sometimes you do not want all corners rounded equally. Flutter supports that too:

Container(
  decoration: BoxDecoration(
    color: Colors.white,
    borderRadius: BorderRadius.only(
      topLeft: Radius.circular(10),
      topRight: Radius.circular(10),
    ),
  ),
  child: Text('Text'),
);

You can also round only one side or create asymmetric shapes using BorderRadius.horizontal or BorderRadius.only.

Choosing the right approach

  • Rounded border around a box: use BoxDecoration with borderRadius.
  • Perfect circle: use shape: BoxShape.circle.
  • Rounded child content only: use ClipRRect.
  • Need Ink effects with rounded corners: consider wrapping the widget in Material with a rounded shape.

Practical tip

If your border still looks off, make sure the same radius is applied consistently to the decoration and any parent or overlay widget that affects the shape. Mismatched radii are a common reason rounded corners look uneven.

Wrapping up

For a bordered Container with rounded corners, the most reliable solution is to define borderRadius in BoxDecoration. That keeps the border visible, gives you precise control over the shape, and works well for both simple cards and more custom UI elements.

If you are building Flutter UI at scale, the same principle applies to testing: consistent widgets are easier to verify and maintain. Repeato can help here with fast no-code test recording for Flutter apps, plus computer-vision-based test execution that is useful when UI shapes and visual states matter.

Like this article? there’s more where that came from!