Flutter Drawer menu with master/details example - flutter

I'm looking for an example that would show how to implement simple drawer menu and master/details screen. I currently have a solution, but it has a flaw. The issue is that when an item in master list view is clicked, the whole drawer is replaced by details screen.
I would like to have drawer always visible.
Is there simple example for this? I haven't found one :/
Thank you!

It seems like a drawer that is always visible is just a Row item?
Row(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
Container(
width: 240.0,
child: <master>,
),
Expanded(child: <detail>),
],
)

I have discover that this is not optimal solution. Best practise shows that opening details always hides drawer menu like in Gmail or other Adndroid apps..

Related

How to prevent EndDrawer closing automatically by outside click in flutter like barrier dismissible in Dialog

I want to prevent End Drawer from closing automatically by clicking outside because if the user accidentally clicks outside of drawer it closes the drawer which is not that great because user filling form or interacting with data in End drawer, I have a close button on the top right of drawer which helps users to close drawer but I do not want to close drawer automatically by outside click, pls help your help will be appreciated
I used the solution from here https://stackoverflow.com/a/71391819
For endDrawer you just need to add mainAxisAlignment.end in Row
return Scaffold(
...,
drawer: Container(
color: Colors.transparent,
child:
Row(mainAxisAlignment: MainAxisAlignment.end,
children: const [SizedBox(width: 304, child: DrawerMenu())])),
...
);

Automatically scrolling to bottom of ListView in flutter

I have been searching for a way to scroll to the bottom of the ListView widget automatically after retrieving data from firebase database. I have seen a number of solutions but they do not work for me.
I find that scrollController.postion.maxScrollExtent is always 0.0. I don't want to use the reverse property of the listView either as that doesn't give me exactly what I want even though very close.
Below is a snippet of the code. When I use chatController.position.maxScrollExtent the value is 0.0 and not the value of the size of the ListView. If I use a listener that listens to scrolls then I see the value of chatController.position.maxScrollExtent but that is not the behaviour I want. I don't want to manually initiate a scroll for the app then go to the bottom of the list. It must do that as I open the app.
Any help will be greatly appreciated. Thanks
Container(
child: Column(
children: <Widget>[
Expanded(
child: ListView(
controller: chatController,
//shrinkWrap: true,
children: [getConversation()], //list of chats wrapped in a Column widget
)
),
)

How to make background not scroll but foreground scroll?

I am use Flutter for web for make website. I need make foreground scroll, but background not scroll like normal website. For example: codemagic.io .
I cannot use Scaffold background because I want use use CustomPainter for custom background.
I am try use Stack, but issue is I need Center Widgets in ScrollView, and if I do this then the CustomPainter is not start from top of page:
Stack(
children: <Widget>[
Center(
child: SingleChildScrollView(
child:
Stack(children: <Widget>[
CustomPaintWidget(),
Widgets(),
],),
Anyone know solution?
Thanks!
You have two stacks here and one is only holding one widget (basically pointless for what you want to do). Put a widget on the bottom index of that stack (0) and make it the size of its container. You could use LayoutBuilder to get the size of its parent widget. Then place the singlechildscrollview on top of that.

Position widgets in stack without overlapping

I have a login screen with a logo on top. I want the login form to be exactly in the screen center (not in the center of the space below the logo). So far I managed to achieve that using Stack, roughly like this:
Stack(
children: [
Positioned(
child: Logo(),
left: 0,
top: 0,
),
Column(
children: [LoginForm()],
mainAxisAlignment: MainAxisAlignment.center,
),
],
)
In general, I am quite happy with how it looks, however, when the soft keyboard pops up, the visible screen size and the notion of the center change, the form moves up and overlaps with the logo. I know I can prevent widgets from resizing at all, but can I just allow the form move up only as long as it does not overlap with the logo?
You can use ListView instead of Column that will avoid overlapping with the logo and when keyboard opens, it will automatically scroll up the form.
Also note that, once you use ListView, use shrinkWrap: true inside it, as it'll only occupy the space it needs.
Hope this answer helps.

Fix widget in bottom space

I need some help with a layout.
I need put some widgets inside a "Scrollview" but keep the buttoms in the bottom space of screen.
Image with a "Scrollview" with some textFields inside, and under de "Scrollview" a Rows containing two buttons
So if I change orientation the Layout will keep buttons at bottom and will scroll the widgets above.
How can I made it in flutter, I tried to use the Stack, Listview and others approaches, but i didn't have luck
Multiple ways. I recommend you either using a Scaffold or a Column:
If you are already using a Scaffold in your app, just add bottomNavigatorBar as a Parameter, your bar you want to have at the bottom in it and make sure the rest of your layout is located under it's body tag.
Otherwise you could use a Column:
Column(
children: <Widget> [
Expanded(child:ScrollView(..),),
yourBottomBar,
] )
Or Flutter also has a Positioned widget which you can use in combination with a Stack:
Stack(
children: [
// some stuff
Positioned(
bottom: 0,
child: yourBottomBar
),
],
)