How do I add two icons and multiple actions on a FAB in Flutter?

189

You can use flutter_speed_dial package/dependency here or try below code hope its help to you.

   floatingActionButton: Row(
    mainAxisAlignment: MainAxisAlignment.end,
    children: [
      FloatingActionButton(
        onPressed: () => {},
        child: Icon(Icons.person),
      ),
      FloatingActionButton(
        onPressed: () => {},
        child: Icon(Icons.home),
      ),
    ]
  ),

Your result screen -> enter image description here

Share:
189
Denish Goklani
Author by

Denish Goklani

Updated on January 01, 2023

Comments

  • Denish Goklani
    Denish Goklani over 1 year

    I want to add two icons on FAB Flutter, one icon will be a map(onPressed show map) and other icon will trigger showBottomModel. A kind of icon switch based floatingActionBar, I don't know if that is possible or please tell me a work around. Thanks.

    • ibhavikmakwana
      ibhavikmakwana over 2 years
      Please share some code, what you've tried so far.
    • Denish Goklani
      Denish Goklani over 2 years
      @ibhavikmakwana I've tried expanded FAB but even that can't contain more than one icon or more than one action. So, I am stuck on this for a while.
  • Denish Goklani
    Denish Goklani over 2 years
    Thanks a lot, I just wanted to ask is it possible to make them as a slider switcher? this works anyway. So, thanks.