How do I change the height of the DrawerHeader in flutter?

Viewed 1569

I want to change the height of the drawer header. I have created a side bar with the help of the drawer but not able to change the height of drawer header.

I'm new in Flutter development.

I have tried this code,

drawer: Container(
        child: ClipRRect(
          borderRadius: BorderRadius.only(
              topRight: Radius.circular(30), bottomRight: Radius.circular(30)),
          child: Drawer(
            child: ListView(
              padding: EdgeInsets.only(
                top: 0.0,
              ),
              scrollDirection: Axis.vertical,
              children: <Widget>[
                DrawerHeader(
                  child: Text('data '),
                  decoration: BoxDecoration(color: Colors.green),
                ),
                ListTile(
                  title: Text('Home'),
                  leading: Icon(Icons.home, color: Colors.red),
                  
                ),
              ],
            ),
          ),
        ),
      ),
2 Answers

Add SizeBox above DrawerHeader

     SizedBox(
              height: 100,
              child: DrawerHeader(
                child: Text('data '),
                decoration: BoxDecoration(color: Colors.green),
              ),
            ),

You can do two things here:

Either use a SizedBox or you can use a customized Container in place of DrawerHeader

SizedBox(
  height: 150.0,
  child: DrawerHeader(
    //add further code here
  ),
),

//OR YOU CAN DO THIS

Drawer(
  child: ListView(
    children: [
      Container(
        height: 150.0,
        child: //add futher code here
      ),
    ],
  ),
)
Related