I want to use Drawer.
When the Drawer unfolds - as you can see in the video in the link - the background or the rest of window is shadowed to let the user focus on the drawer.
I feel that the shadow is very dark, is there any way to change the color of the shadow?
The documentation for the Drawer class lists several parameters such as shadowColor but it seems to be outdated since the Drawer class only takes the parameter
this.backgroundColor,
this.elevation,
this.shape,
this.width,
this.child,
this.semanticLabel,
Any idea or trick?
Changing the overlay color of the Drawer doesn't have to do with the Drawer, but rather the Scaffold itself. You need to set drawerScrimColor to transparent:
The color to use for the scrim that obscures primary content while a drawer is open.
Scaffold(
drawerScrimColor: Colors.transparent,
Related
I'm working on my flutter project and trying to figure out how to make in bottom navBar make each item in a different color. For example, I have:
[icon]Home [icon]Settings [icon]Help [icon]Chat
I need to make the first item (icon&text) in one color, item2(icon&text) in another color, etc
As on the screenshot. Is that even possible? navBarScreenshot
if you using the bottom navigation bar widget there is a function called selectedItemColor: which can be used to change the color of the selected item or you can just give a container as a widget in BottomNavigationBarItem(icon: Container()) and give it a custom color according to your liking
Is there any easy way to have a SliverAppBar be transparent when expanded and then take a color when collapsed when used in combination with a FlexibleSpaceBar?
I want to use the FlexibleSpaceBar so that my title will collapse when the sliver list is scrolled up and down
It seems right now the default behavior is the opposite. If you make the sliverAppBar transparent off the bat
SliverAppBar(
pinned: true,
expandedHeight: 100.0,
elevation: 0,
backgroundColor: Colors.transparent,
Then there is no way to control the background color when its collapsed. If you try to give a color here, then when its collapsed it successfully has a color but it cannot be made transparent when expanded.
Ok I ultimately solved this by keeping the SliverAppBar as transparent, and then placing a Container widget into it. Then using a scrollcontroller listener, I would animate the color of the containers background color as a scroll is happening.
It was a painful process, but it is working flawlessly
What I want to achieve is like when you use the alert dialog widget :
When the dialog box shows everything in the background is darkened and disabled. I want to do that but I don't want to use a dialogbox , I have a Container that slides from the bottom of the screen, it's inside a Stack widget.
How can I achieve this?
Wrap your widget with Scaffold and set the backgroundColor to
// change the color as you like
backgroundColor: Colors.black.withOpacity(0.3),
I do not know how it is called but I want to remove what you see on the picture (the darker grey part). I want that the grey square outline disappears when I click on something.
https://i.stack.imgur.com/1iJUP.jpg
https://i.stack.imgur.com/hj0ny.gif
In general..it is the splash color..
For ex: if we consider RaisedButton
you can do something like this..
RaisedButton(
spashColor: Colors.green, //your desired color
child: Text("hello"),
)
You can do the same for FlatButton also..
If you don't want any color..then you can set it to "Colors.transparent"
Given that you state the widget seen in the image is a BottomNavigationBar, you can set the background color via the backgroundColor attribute.
You can set this attribute to the desirer color or a transparency (which would reveal the underlying scaffold color instead)
However, if the widget in question turns out to be a shifting background navigation bar the background color of the inner item's will overwite that. In which case you would instead need to set the background color of the specific item.
Source : https://api.flutter.dev/flutter/material/BottomNavigationBar/backgroundColor.html
I created a Scaffold widget with appBar and drawer.
As I open the drawer, there is a shadow over the Scaffold's body widget. I'd like to either remove the shadow, make it not so "strong" or change the shade slightly.
I checked the docs and I didn't find any way to achieve this through public API.
Is there any way to remove the drawer menu's "drop shadow" on the body?
The elevation option is something different, even if I set it to 0, the overlay shadow on top of the body is still present.
This issue's description's screenshots might help clarify what I want.
If you want to get rid of the shadow over the Scaffold body then you have to change the Scaffold's drawerScrimColor's value to Colors.transparent.
Have you tried setting the drawer's elevation to elevation: 0.0?
check this
drawerTheme:
DrawerThemeData(scrimColor: Colors.transparent, elevation: 0.5),