Flutter Custom Drawer to Default in Existing code - flutter

i'm new in flutter i have a project that used Custom drawer menu as shown below
enter image description here
there's 2 files that should be edited i think
main_screen.dart this file contains menu items
main_screen.dart Code
Menu_screen.dart CODE
i've Replaced all instances of CustomDrawer with Drawer in your code. Remove the CustomDrawerController class and its usage. but still i got errors can you guide me how can i change to default drawer menu easily?
i've replaced CustomDrawer to Drawer but it seems won't work

In order to create UI like this you have to create a stack widget and in the stack place your drawer widget and on the top of the drawer widget place your main screen widget and in the main screen create a button on the onpressed of that button the main screen will be made small and shifted to the side drawer will be visible
the full code is here
https://github.com/singh-saheb/pet_ui_flutter.git
and the video explanation is here
https://www.youtube.com/watch?v=Cg9vLhfvWBE

Related

Beautiful and responsive "dropdown menu" / "pop-up" flutter

Please see the photos attached for the feature, or simply head to https://www.chrislorenzomusic.com and resize the window until you see the dropdown menu in top right corner appears and click on the menu to see the effect.
I'm not sure what this effect or feature is called, but was wondering what it's called and if it was possible to make something similar in flutter?
Before resizing the window
After resizing window the menu at top right corner appears
When clicking on the menu
When an app or widget behaves differently depending on the screen size or orientation it is considered responsive or has a responsive layout.
https://docs.flutter.dev/development/ui/layout/adaptive-responsive
The Menu itself can be created using a Scaffold with an AppBar and a Drawer. You can configure the AppBar to have the menu icon or the links depending on the size using LayoutBuilder and MediaQuery.of.
AppBar
https://material.io/components/app-bars-top
Drawer
https://material.io/components/navigation-drawer

Flutter close drawer on back button press in bottom navigation bar

I'm building a flutter app with persistent bottom navigation bar that contains a menu button.
The menu is supposed to open a drawer from any screen and trough the back button it should close it.
For that I'm using a scaffold including the bottom navigation widget and also the drawer.
This works fine for all screens that are directly accessible trough the bottom navigation bar.
The problem arises if I navigate (I'm using auto_route for routing) to another sub page.
In the sub page it seems that it is not possible to close the drawer.
In the sub page I dont provide a Scaffold since I would have nested scaffolds.
I'm using the WillPopScope and onPop looks like this:
if (Scaffold.of(context).isEndDrawerOpen) {
Navigator.of(context).pop();
Unfortunately this just pops the sub page while the drawer stays open.
One solution would be to pass a closing function to every child screen (or something like a global key for the global scaffold) but I would appreciate a more elegant solution
Do you have any idea how I can fix that?
Thanks in advance!

How to open second container in Flutter when I click on IconButton?

I added Row widget with rendering on stack widget. I actually want to add more container, but it shows when I click on IconButton. After clicking it does not shows on screen. So how is possible in Flutter ?
Any suggestion?
you could create a stack widget and when the IconButton is pressed you call a function to display the new container( which probably is inside the stack widget you are going to implement)

Update BottomNavigationBar when tapping on Button

I'm looking for a way to update the backgroundColor of the BottomNavigationBar when the user taps on a button. The problem here is the BottomNavigationBar aren't in the same file as the button. My application is divided into two files. The first file, main.dart, includes a StatefulWidget with a BottomNavigationBar. The other file, home.dart, has a StatefulWidget too with a button. The question is how to update the BottomNavigationBar when the user tapping on the button? Basically with calling setState() everything is fine, but as I said the BottomNavigationBar is located in an other file. I've absolutely no idea and I'm not sure if this is even possible.
I added no code because I'm not really asking for code snippets but rather food for thought or explanations what I can do.
Make your bottom navigation bar file as Stateless shown in this dart pad example
Example on Github
In this on click of press button color of bottom navigation bar changes
Let me know if it work out or not for you.

Flutter overlay is moving

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.