dartwidgetstackflutter

How to add Multiple Floating button in Stack Widget in Flutter


In flutter one view over another view using Stack Widget. It's work fine. Now I need to added two floating button left and right side of bottom of screen. I added one button right side but I dnt know how to add floating button left side. Simple like below image.

enter image description here

Any help will appreciable


Solution

  • You can use the Align widget to position your FloatingActionButton's in the Stack.

    Stack(
      children: <Widget>[
        Align(
          alignment: Alignment.bottomLeft,
          child: FloatingActionButton(...),
        ),
        Align(
          alignment: Alignment.bottomRight,
          child: FloatingActionButton(...),
        ),
      ],
    )
    

    One button uses constant Alignment.bottomLeft for its alignment property and the other one respectively Alignment.bottomRight.