Reputation: 3410
Flutter has a whole class of components from Material Design built-in. When the Scaffold makes things easier for a lot of developers, my case is a weird one where I want the body behind the transparent appbar.
How to display body under the Appbar of scaffold widget and not bellow?
I switched to use Stack for setting up the appbar and other content in the body. Now I feel it is harder to use most components from the material design library. Most things get harder as everywhere it gets linked to Scaffold component and I'm not using it.
How should I implement a drawer in Flutter without using Scaffold?
Upvotes: 1
Views: 2561
Reputation: 40443
I'm going to give a sort-of-answer here.
It is definitely possible to do using just a ScaffoldController and a MultiChildLayoutDelegate in the same way that Scaffold does it (this nice thing about flutter is that everything is open source so you can read & duplicate the relevant parts), but it is not simple. If you really want to do this, I'd advise reading through the source code for Scaffold until you understand what's going on. You could then copy out the relevant parts of code until you have it working.
There is an easier way though that I think would work for you. I would recommend instead that you do use a scaffold. There's nothing saying you have to use its AppBar
- you can still have your custom implementation contained within the body. This way, you get drawer
, including LTR RTL stuff and whatever else Scaffold does, without having to implement & maintain all of it.
If this still doesn't work for you and you can't get anywhere looking through the source, let me know and I might be able to look into creating a simple example when I have more time.
Upvotes: 4