Last active
October 25, 2018 07:37
-
-
Save vemarav/78cb38a953a51366ffae95d0f7fff56f to your computer and use it in GitHub Desktop.
Flutter Navigation Drawer Header
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
import 'package:flutter/material.dart'; | |
const String _AccountName = 'Aravind Vemula'; | |
const String _AccountEmail = '[email protected]'; | |
const String _AccountAbbr = 'AV'; | |
void main() => runApp(new Keeper()); | |
class Keeper extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return new MaterialApp( | |
title: 'Keeper', | |
home: new KeeperDrawer(), | |
); | |
} | |
} | |
class KeeperDrawer extends StatelessWidget { | |
Drawer drawer = new Drawer( | |
child: new Column( | |
children: <Widget>[ | |
new UserAccountsDrawerHeader( | |
accountName: const Text(_AccountName), | |
accountEmail: const Text(_AccountEmail), | |
currentAccountPicture: new CircleAvatar( | |
backgroundColor: Colors.brown, | |
child: new Text(_AccountAbbr) | |
), | |
) | |
] | |
) | |
); | |
@override | |
Widget build(BuildContext context) { | |
return new Scaffold( | |
drawer: drawer, | |
appBar: new AppBar( | |
title: new Text('Keeper'), | |
), | |
body: new Center( | |
child: new Text('Hello World!') | |
) | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment