Question Detail

I want to add more than one FloatingActionbutton on the flutter app screen. but build function can contain only on floating button How can I add floatingActionButton  on the page


Thread Reply

Hemant Sharma

- 4 months ago

Hello, floatingActionButton is also a widget you can add or append your own customize widget so you can add Column or Row anything else which can meet your requirements.

floatingActionButton:Column(
          crossAxisAlignment: CrossAxisAlignment.end,
          mainAxisAlignment: MainAxisAlignment.end,
          children: [
            FloatingActionButton.extended(
                onPressed: (){ print("Office floating se"); },
                label: Text('To My Office!'),
                icon: Icon(Icons.laptop),
            ),
            FloatingActionButton(
              heroTag: null,
              child: Icon(Icons.share,color: Colors.white,),
              onPressed: (){},
            ),
          ],
        )  
 

Hemant Sharma

- 4 months ago

Hello, floatingActionButton is also a widget you can add or append your own customize widget so you can add Column or Row anything else which can meet your requirements.

floatingActionButton:Column(
          crossAxisAlignment: CrossAxisAlignment.end,
          mainAxisAlignment: MainAxisAlignment.end,
          children: [
            FloatingActionButton.extended(
                onPressed: (){ print("Office floating se"); },
                label: Text('To My Office!'),
                icon: Icon(Icons.laptop),
            ),
            FloatingActionButton(
              heroTag: null,
              child: Icon(Icons.share,color: Colors.white,),
              onPressed: (){},
            ),
          ],
        )