Route to another widget while Drawer stays on the appbar - dart

I have the following drawer. it works as it should as long as i only want to hop between the widgets of my main drawer items.
Navigation with drawer
but inside those widgets i want to route to a new one, with a button click for example, while the drawer stays in my corner. So basically is there any way to reproduce a sticky android drawer in flutter ?

Drawer is a Scaffold property.
So when you go to another page you will normally have another Scaffold widget with its own Drawerand the previous one will be disposed.
In the new page you need to create and display the Drawer for this Scaffold but you can't keep the previous one in the corner.

Since the two widgets are independent of each other, you cannot use the same exact Drawer in the second widget.
Either you can create the exact copy of that Drawer in second one and open it on initState method or if possible instead of switching to the second, you can make the second widget as a subview inside firstWidget.

Related

How can i toggle the sliver appbar to activate or deactivate itself and act as a normal appbar?

I have 2 tabs in my app, can i toggle the sliver appbar to act like a normal appbar when im on the second tab but remain flexible on the first one?
Without the sample code not much help could be provided.
At the very least a GitHub link to the repo.
However based on your question you could look into state management.
whereby there is conditional rendering of widget.
The page will render a normal app bar in one state and the other state render the flexible app bar.

Flutter - Drawer button shown instead of back button

I am creating a shopping cart in flutter as my first project. The link to the Cart is inside Appbar.
When I navigate to the Cart the back button on the top left of the Appbar is not showing, instead the drawer button is shown.
For other pages that I navigate say, a product page, the back button is shown.
What could be the issue, please suggest.
I compare line by line and the cart.dart have this offending line
drawer: appDrawer
between the appBar and Boxy which seems to override the back button.
#Viren V Varasadiya and #Harsha pulikollu thank you for your looking into my question.

Accessing the route's transition animation from a widget?

I have two pages, both with their own Scaffold and a slightly different AppBar. I use Navigator.push to switch between them.
The second page is a popup which overlays the first page by having a transparent Scaffold with body of about 50% screen height. Here's how it looks:
In the first page, the red curtain ends just below the AppBar. When you open the second page, the curtain animates down to the screenshot above. I achieved this by starting the down animation in initState of the second screen.
Now, I want the opposite animation of the curtain rolling back up when you leave the second page. How would I do that? Is there a way to animate widgets (not just fade/slide whole pages) when you enter/leave the page?
Can I access the Route's transition animation (the same one that is passed to Route.buildTransitions) and use it to animate widgets inside the page itself?

Update Scaffold contents (appBar title and body) without pushing a new view?

Say I have a main, top-level Scaffold with an appBar and and body.
I have a button in the appBar and in its onTap I do:
Navigator.push(
context,
new MaterialPageRoute(builder: (_) => new DogeWidget())
);
Now DogeWidget is also aScaffold, because I like the appBar's default rendering.
What's happening:
I see the DogeWidget slide from the bottom of the screen. It's a whole scaffold sliding, not just the body.
What I'd like to see:
The main appBar's contents change, its hamburger changes into a "back arrow". There is no slide from the bottom, just an ordinary fade.
I don't know if I should write this myself or is there something that Flutter can provide?
AFAICT, the Gallery does what I want (e.g. tap on the "typography" item) - behavior is different despite my code being an almost literate copy and paste. Why?
For a while we had a hack that made this happen by making the AppBar a Hero, but it was not a good implementation and caused more trouble than it was worth so we backed it out. That's probably what you're seeing.
There's no easy way to do this using Navigator with today's material framework, though you can certainly implement widgets on top of the widgets layer that do it if you want to. What you might be able to do though is implement it by having a Navigator inside the body of your MaterialApp, and then manually replacing the AppBar (maybe via a crossfade widget like AnimatedCrossFade).
Solving this properly is something we intend to do in due course but we are prioritising bugs and API stability at the moment so it is not something we plan to do in the near term (next few months).

Delphi proper use of TMultiView

As you know there is a new component called TMultiView that can be user as navigation drawer if you set the mode to Drawer. Let's say that I have a drawer with 5 buttons inside and each of them, when clicked, shows in the main form a particular layout.
I was thinking that I could add to my form a lot of TLayout and set their visibility to false. Then, when I click in a button of the Drawer, I set the respective visibility to true/false.
I am not sure if this is a good way to structure the app. Do you have any suggestion?
One approach is to place a TabControl on the form. As you have 5 buttons and want 5 different "layouts" you would add 5 tabs to the TabControl. On each tab place a TLayout.
At design time it is straight forward to design each of the layouts.
At run time switch to the appropriate layout.

Resources