How to create a rounded button in Flutter

October 09, 2022 No comments flutter dart rounded-corners border-radius

Introduction

Sometimes, we need to create a rounded button in Flutter. In this article, we'll look at how to do it.

How to create a rounded button in Flutter

To create a rounded button in Flutter you can use the RoundedRectangleBorder class and set it to the shape property that exists inside style property:

style: ButtonStyle(
  shape: MaterialStateProperty.all<RoundedRectangleBorder>(
    RoundedRectangleBorder(
      borderRadius: BorderRadius.circular(18.0),
      side: BorderSide(color: Colors.red)
    )
  )
)

Conclusion

In this post, we presented the best way to create a rounded button in Flutter.

{{ message }}

{{ 'Comments are closed.' | trans }}