Search code examples
flutterdartflutter-layout

How to change the size of FloatingActionButton?


I'm trying to set a size to a FloatingActionButton in flutter, I wanna set width/height, I mean, make the button bigger, I was looking for a circular button, but the only one that I got was this one, so, I started to work with this, but I need it a little bigger.


Solution

  • Use a Container where you can specify width and height, then use a RawMaterialButton, like this:

    final myFabButton = Container(
      width: 200.0,
      height: 200.0,
      child: new RawMaterialButton(
        shape: new CircleBorder(),
        elevation: 0.0,
        child: Icon(
          Icons.favorite,
          color: Colors.blue,
        ),
        onPressed: () {},
      ),
    );