Search code examples
flutterflutter-layoutfloating-action-button

How can I move floating action button to the left side of the Screen in Flutter?


By default floating action button is at the right side of the screen. I know about the floatingActionButtonLocation and its properties like endDocked, startDocked, centerDocked, but none of them helped me in moving it to the left side of the screen.


Solution

  • Basically suggested by @E.Bradford in the comment above, but I wanted to provide some code, if needed. You can place the FloatingActionButton pretty much anywhere you want by stacking it into a positioned widget.

    Stack(
      children: [
        Placeholder(),
        Positioned(
          left: 40,
          bottom: 40,
          child: FloatingActionButton(
            onPressed: () {},
          ),
        ),
      ],
    )
    

    enter image description here