Home > OS >  How to adjust ElevatedButton size using style: ButtonStyle?
How to adjust ElevatedButton size using style: ButtonStyle?

Time:11-19

Struggling with the ButtonStyle section. I want to change the height of the button.

style: ButtonStyle(
                    fixedSize: MaterialStateProperty.all(
                      Size.fromHeight(150),
                       ),
),

Note: I don't want to use .styleFrom

CodePudding user response:

Wrapping a widget with a SizedBox will make it the height and width given.

SizedBox(
  height: 200,
    child: ElevatedButton(
      child: Text('something'),
      onPressed: () {},
    ),
  )

CodePudding user response:

I figured it out:

style: ButtonStyle(
   fixedSize:
      MaterialStateProperty.all(const Size(80, 80)),
),
  • Related