Question

flutter move floatingActionButton up 50 pixels

Is it possible to move the floatingActionButton up by 50 pixels?

I have a floatingActionButton in an App that uses firebase_admob and the Ads Banner is overlapping on top of the floatingActionButton.

How does one set the floatingActionButton to be 50 pixels from the bottom of the screen?

From the documentation of floatingActionButton I can not seem to pick out how to position the button.

 46  38688  46
1 Jan 1970

Solution

 101

Wrap your FloatingActionButton inside a Padding and add the size you want:

    floatingActionButton: Padding(
            padding: const EdgeInsets.only(bottom: 50.0),
            child: FloatingActionButton(
              child: Icon(Icons.remove),
              onPressed: () => null,
            ),
          ), 
2019-01-13

Solution

 13

It's simple.

class Test extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(),
      body: Container(),
      floatingActionButton: Align(
          child: FloatingActionButton(onPressed: null),
          alignment: Alignment(1, 0.7)),
    );
  }
}

Use Alignment, as everything is a Widget in Flutter.

2019-01-13