Flutter | Different ways to create rounded box using Container()

In app development, buttons, cards or any thing else looks great if they are rounded slightly.

As of now, I came across with two methods mainly but there can be many methods we can round the borders of button or container or card

  1. BoxDecoration in Container
  2. ClipRRect Widget
  • First let’s start with BoxDecoration

inside Container decoration property, add the following

decoration:

as a child we can put any widget as you might know, so the full code for Container will look something like this

Container(
  • ClipRRect Widget

wrap widget with ClipRRect and provide appropriate border radius

borderRadius: BorderRadius.circular(12.0),

full code will look like this

ClipRRect(

and that’s all for now

I write articles for my own reference only. I use medium.com as my digital notebook