Search code examples
flutteruser-interfacemobile-application

How to set size to FloatingActionButton - Flutter


I want to make a button bigger. the button in the card widget and it is in Align tag..

Align(
    alignment: Alignment(0.9, 0.9),
    heightFactor: 0.0,
    child: FloatingActionButton(
        onPressed: null,
        child: Icon(Icons.share),
    ),
),

Solution

  • You need to wrap your FloatingActionButton inside a Container and manage the size of the Icon with the size element:

         Align(
            alignment: Alignment.center,
            child: Container(
              width: 100,
              height: 200,
              child: FloatingActionButton(
                onPressed: null,
                child: Icon(
                  Icons.share,
                  size: 80,
                ),
              ),
            ),
          ),