Last active
February 5, 2022 14:44
-
-
Save faizan1947/c030fd88dbc72896c47543ba7a145cd1 to your computer and use it in GitHub Desktop.
Flutter Custom Drawer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ignore_for_file: prefer_const_constructors | |
import 'package:flutter/cupertino.dart'; | |
import 'package:flutter/material.dart'; | |
class MyDrawer extends StatelessWidget { | |
const MyDrawer({Key? key}) : super(key: key); | |
final imageURL = "https://avatars.githubusercontent.com/u/61882549?v=4"; | |
@override | |
Widget build(BuildContext context) { | |
return Drawer( | |
child: ListView( | |
children: [ | |
DrawerHeader( | |
padding: EdgeInsets.zero, | |
child: UserAccountsDrawerHeader( | |
margin: EdgeInsets.zero, | |
accountName: Text('Faizan'), | |
accountEmail: Text('[email protected]'), | |
currentAccountPicture: | |
CircleAvatar(backgroundImage: NetworkImage(imageURL)), | |
), | |
), | |
ListTile( | |
leading: Icon( | |
CupertinoIcons.home, | |
color: Colors.black, | |
), | |
title: Text( | |
'Home', | |
textScaleFactor: 1.2, | |
), | |
), | |
ListTile( | |
leading: Icon( | |
CupertinoIcons.info_circle, | |
color: Colors.black, | |
), | |
title: Text( | |
'Info', | |
textScaleFactor: 1.2, | |
), | |
), | |
], | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment