I've been a Flutter dev for many years and I still need to Google "Flutter border radius" sometimes. 😅
Let's put it to rest! This is the easiest way to get a rounded rectangle with a given radius:
A couple things to note:
Container
also has adecoration
argument, but usingDecoratedBox
is more lightweight.- the above also works with
BorderRadius.circular(16)
, howeverBorderRadius.all()
is aconst
constructor and therefore more optimal.
Found this useful? Show some love and share the original tweet 🙏
Previous | Next |
---|---|
Flutter Fix all command | Chat UI with message bubbles |