Reputation: 1436
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.
Upvotes: 46
Views: 40423
Reputation: 103401
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,
),
),
Upvotes: 101
Reputation: 11651
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.
Upvotes: 15