Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Flutter ElevatedButton shape – rectangle

This should be the easiest one ever.

I am coming back to flutter after years away as I am forced to update my old app. Everything has changed!

I am trying to make an ElevatedButton that is square. The default has slightly rounded edges that looks weird when I am making a button the width of the screen.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

All I want to know is how I can make this button a square. That’s it! No tricks!

ElevatedButton has:

ElevatedButton.styleFrom(
    shape:  ???,
),

But I can’t find any information anywhere online what my options are for shape. Only a few examples on how to make it round or beveled or literally every other shape you can think of except for a simple rectangle 😀

>Solution :

Try below code:

ElevatedButton, ButtonStyle, BorderRadius

ElevatedButton(
  style: ElevatedButton.styleFrom(
    shape: RoundedRectangleBorder(
      borderRadius: BorderRadius.circular(20),
      //borderRadius: BorderRadius.zero, //Rectangular border
    ),
  ),
  onPressed: () {},
  child: const Text(
    'Submit',
  ),
),

Result-> image

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading