Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

adding width to drawer in flutter

Tags:

I want to be able to add width to this drawer because it takes up too much of the screen when open and I want to lessen the width a bit, is this possible and how would I do this?

here is my scaffold

Widget build(BuildContext context) { return new Scaffold(   appBar: new AppBar(     title: new Text("App Name"),     centerTitle: true,   ),   body: new Center(   ),    drawer: Drawer(   child: ListView(       padding: EdgeInsets.zero,       children: <Widget>[       UserAccountsDrawerHeader(         accountName: Text('Test123') ,         accountEmail: Text('[email protected]'),         currentAccountPicture: Image.network('https://images-wixmp-ed30a86b8c4ca887773594c2.wixmp.com/f/a89c3e38-b6f3-48a0-9f9e-df9a0129fb93/daghh5x-4a77b3ec-fd4f-4d17-9f84-5963a8cb5c03.png?token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ1cm46YXBwOjdlMGQxODg5ODIyNjQzNzNhNWYwZDQxNWVhMGQyNmUwIiwiaXNzIjoidXJuOmFwcDo3ZTBkMTg4OTgyMjY0MzczYTVmMGQ0MTVlYTBkMjZlMCIsIm9iaiI6W1t7InBhdGgiOiJcL2ZcL2E4OWMzZTM4LWI2ZjMtNDhhMC05ZjllLWRmOWEwMTI5ZmI5M1wvZGFnaGg1eC00YTc3YjNlYy1mZDRmLTRkMTctOWY4NC01OTYzYThjYjVjMDMucG5nIn1dXSwiYXVkIjpbInVybjpzZXJ2aWNlOmZpbGUuZG93bmxvYWQiXX0.dWTFMrwnbAbj5TtUp9U_vQsohW7MnkRPymzR5wZQoV8'),         ),          ListTile(           title: Text('data'),         ),       ],     ),   ), ); 
like image 977
overdeveloping Avatar asked Aug 02 '19 19:08

overdeveloping


People also ask

How do you raise the Drawer height on a 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.


1 Answers

Wrap the Drawer widget inside a Container widget and pass the width parameter to the Container.

drawer: Container(       width: 50,       child: Drawer(         child: ListView(           padding: EdgeInsets.zero,           children: <Widget>[             UserAccountsDrawerHeader(               accountName: Text('Test123'),               accountEmail: Text('[email protected]'),               currentAccountPicture: Image.network(                   'https://images-wixmp-ed30a86b8c4ca887773594c2.wixmp.com/f/a89c3e38-b6f3-48a0-9f9e-df9a0129fb93/daghh5x-4a77b3ec-fd4f-4d17-9f84-5963a8cb5c03.png?token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ1cm46YXBwOjdlMGQxODg5ODIyNjQzNzNhNWYwZDQxNWVhMGQyNmUwIiwiaXNzIjoidXJuOmFwcDo3ZTBkMTg4OTgyMjY0MzczYTVmMGQ0MTVlYTBkMjZlMCIsIm9iaiI6W1t7InBhdGgiOiJcL2ZcL2E4OWMzZTM4LWI2ZjMtNDhhMC05ZjllLWRmOWEwMTI5ZmI5M1wvZGFnaGg1eC00YTc3YjNlYy1mZDRmLTRkMTctOWY4NC01OTYzYThjYjVjMDMucG5nIn1dXSwiYXVkIjpbInVybjpzZXJ2aWNlOmZpbGUuZG93bmxvYWQiXX0.dWTFMrwnbAbj5TtUp9U_vQsohW7MnkRPymzR5wZQoV8'),             ),             ListTile(               title: Text('data'),             ),           ],         ),       ),     ), 
like image 102
oneimperfectguy Avatar answered Oct 12 '22 12:10

oneimperfectguy