Flutter overlay is moving - flutter

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.
Problem animation

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:
Either you create your own versiĆ³n of the FAB which is not
controlled by the Scaffold.
Or you hack the Scaffold so the size of the SnackBar is not taken
into account.
For this second option you can try the following:
Go to the file /lib/src/material/scaffold.dart in your flutter installation and look for the line with the code snackBarSize: snackBarSize, inside the _ScaffoldLayout class.
Replace it with snackBarSize: Size(0.0, 0.0),
You will see that the FAB stays in its place.

Related

Is there any way I can implement pull down appbar in flutter?

Can anyone suggest to me how can I build a pull-down appbar. I searched the whole net but can't find any idea regarding this. It would be great if anyone could guide or suggest to me to build the appbar.
Edit:-
Many developers are saying to use SliverAppBar. SliverAppBar basically collapses the app bar when we scroll up the listview or any other widget, whereas I want an app bar that pulls down i.e when we tap the app bar and scroll it down only the app bar grows on top of the body. So basically when we navigate to the home screen the app bar should look like the second referred image i.e it must be closed. But we can pull down that appbar to view the hidden contents of the appbar. I am attaching an image for reference.
I Think what you mean what pull down App is an Appbar that expands try.
the silver Appbar
https://youtu.be/mSc7qFzxHDw

Flutter: Custom pain on bottom of the page with TextField

I am trying to create a user interface with a custom paint on the bottom and with two text fields on the bottom too.
The problem is when the keyboard is shown, the TextFormFields go up while the bottom paint does not go anywhere.
You can see what I mean in the pictures below:
Any ideas about what goes wrong?

How do you create a side navigation drawer that persists across pages?

I've looked through many tutorials for the side nav drawer. I can create one that works fine to lead to different pages. However, when I travel to a page that's different from home, it only gives me the arrow icon to go back to home at the top left instead of keeping the button to bring me back to the side navbar. How can I prevent this?
I can't use the home page to navigate everywhere because it's just supposed to be a blank splash screen.
You can define your drawer in a separate widget file, that you can import everywhere you have a scafold.
I created a package for it because I was missing similar functionality. If you want a Flutter approach for this navigation check out: https://api.flutter.dev/flutter/material/NavigationRail-class.html
Or if you want to have a look at my package: https://pub.dev/packages/side_navigation
It's because you're moving to a new page/Scaffold (probably using Navigator.push()). So, the default button in the AppBar will be the back button.
You can either have the same Drawer in every Scaffold you navigate to, which is not recommended since you'll just keep pushing routes to the navigation stack.
Or, you can change pages within the Scaffold. Check the interactive examples in BottomNavigationBar and NavigationRail to get an idea of how to do it. Basically instead of calling Navigator.push() when a tile in Drawer is tapped, just update the selected index and call setState().

I want to make a container under app bar which works like a secondary App Bar where I can put my back icon button and title in the center in flutter

I have tried everything. But I can't find a permanent solution How to put the title in the center while my back icon button on the left side. I want to use this secondary app bar on every screen of my app.
Please check the image below for a better understanding.
This is the problem that I am facing
Take a ListView Widget at body of Scaffold and in its children put first widget as a ListTile that comes under AppBar. So that there will be a leading icon and title in center. After that take a Column and add your needed widgets for every page.

Is there a way to add shadow behind the app bar action buttons in Flutter?

I am using SliverAppBar widget with some background image behind it. Since the image I will load will be dynamic, sometimes it can have light colors and can cause the back button (or any other action button) to be hardly visible.
As you can see in the screenshot below, I gave a little shadow to the app bar title using TextStyle & Shadow widgets, so it is much more visible than the back button.
You can try use "elevation" here is the Flutter link for more clarification: https://www.google.com/url?sa=t&source=web&rct=j&url=https://api.flutter.dev/flutter/material/SliverAppBar/elevation.html&ved=2ahUKEwiEpfiIn4TwAhWUH7cAHY9ECIwQFjACegQIBRAC&usg=AOvVaw0wCdyaVv3EA8ulVXXvaVMu