Reputation: 11
I'm asking how to disable Overlays to move when a Scaffold.of(context).showSnackBar is called like on my video below. The same thing is happening when the keyboard appear. Sometime the blue floattingButton (+) don't come back to it's original position :-(
Thx in advance.
Upvotes: 1
Views: 638
Reputation: 20548
The FloatingActionButton
going up when the Scaffold
is displayed is something common to all default implementations.
Give a look to the "Bootom app bar" demo in the Gallery app. Press on the search button and you will see it coming up. Or just add a Scaffold
to the app that is built with flutter create
command.
This happens because of the way the FAB button is placed on the screen and the effect of displaying the Snackbar
by the Scaffold
.
The FAB button is displayed at the bottom of the content area of the Scaffold
content. When the content area is shrinked to include the BottomAppBar
, the FAB goes up with it. It has nothing to do with Overlay
.
You have two options:
Scaffold
.SnackBar
is not taken
into account.For this second option you can try the following:
snackBarSize: snackBarSize,
inside the _ScaffoldLayout
class.snackBarSize: Size(0.0, 0.0),
You will see that the FAB stays in its place.
Upvotes: 1