DEV Community

Cover image for How to Set Height to a Drawer Header In Flutter?
Pankaj Das
Pankaj Das

Posted on • Originally published at flutteragency.com

How to Set Height to a Drawer Header In Flutter?

Earlier, we have been through What is Navigation Drawer In Flutter. So in this article, we will go through How to Set Height to a Drawer Header in Flutter?

How to Set Height to a Drawer Header in Flutter?
You wrap this with a Container Widget.

Code Snippet will look like the below:

Container(
  height: 200.0,
  child: DrawerHeader(
    child: Text('Categories', style: TextStyle(color: Colors.white)),
      decoration: BoxDecoration(
      color: Colors.black
    ),
    margin: EdgeInsets.all(0.0),
    padding: EdgeInsets.all(0.0)
  ),
);

Enter fullscreen mode Exit fullscreen mode

You can also use SizedBox Widget to resize the height DrawerHeader.

SizedBox Widget: This widget forces to give specific Height and width to a given class. If SizedBox Widget does not permit, then these values will be ignored. If either the Height or width is null, this widget will try to resize its size to match its child`s size.


SizedBox(
height : 120.0,
child : new DrawerHeader(
child : new Text('Categories', style: TextStyle(color: Colors.white)),
decoration: new BoxDecoration(color: Colors.black),
margin : EdgeInsets.zero,
padding: EdgeInsets.zero
),
);

Conclusion:
Thanks for being with us on a Flutter Journey !!!

In this article, We have been through How to Set Height to a Drawer Header in Flutter…

Also, check out this article for How to Setup Height of the AppBar in Flutter.

Keep Learning !!! Keep Fluttering !!!

Flutter Agency is our portal Platform dedicated to Flutter Technology and Flutter Developers. The portal is full of cool resources from Flutter like Flutter Widget Guide, Flutter Projects, Code libs and etc.

FlutterAgency.com is one of the most popular online portals dedicated to Flutter Technology and daily thousands of unique visitors come to this portal to enhance their knowledge of Flutter.

Discussion (0)