Flutter: Floating action button fixed location

How can I make the FloatingActionButton fixed in its location, so that it won't move when the keyboard appears?

I have tried this:

resizeToAvoidBottomPadding: false,

But this will also prevent my SingleChildScrollView from moving.

1 answer

  • answered 2019-05-21 22:24 Vimukthi Bandara

    Wrap it Using a Stack and use Positioned widget and make the FloatingActionButton a child of Positioned widget.

    example

    Stack(children: <Widget>[
     new Positioned(
       left: 50.0,
       top: 50.0,
       child: new FloatingActionButton(
    
        onPressed: () {
        // Add your onPressed code here!
      },
      child: new Text("Button")
      ),],);