Skip to content

Instantly share code, notes, and snippets.

@vemarav
Last active October 25, 2018 07:37
Show Gist options
  • Save vemarav/78cb38a953a51366ffae95d0f7fff56f to your computer and use it in GitHub Desktop.
Save vemarav/78cb38a953a51366ffae95d0f7fff56f to your computer and use it in GitHub Desktop.
Flutter Navigation Drawer Header
import 'package:flutter/material.dart';
const String _AccountName = 'Aravind Vemula';
const String _AccountEmail = 'vemula.aravind336@gmail.com';
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