Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change size of FloatingActionButton

How do I change the size of a FloatingActionButton?

I've tried increasing the size of the icon, but it doesn't affect the surrounding circular shape. I've also tried wrapping the button in a PreferredSize widget, but this had no effect.

like image 407
Duncan Jones Avatar asked Oct 16 '22 13:10

Duncan Jones


1 Answers

Wrap the FloatingActionButton in a Container, specifying the width and height.

You can override the size of the icon to make it look more natural:

Container(
  width: 80.0,
  height: 80.0,
  child: FloatingActionButton(
    onPressed: () {},
    child: Icon(
      Icons.add,
      size: 30.0,
    ),
  ),
);

I was pleased to discover the notch size is adjusted accordingly if you are embedding this button in a BottomAppBar.

like image 158
Duncan Jones Avatar answered Dec 09 '22 11:12

Duncan Jones