import 'package:flutter/material.dart';
void main() => runApp(new MaterialApp(
title: "抽屉组件示例",
home: LayoutDemo(),
));
class LayoutDemo extends StatelessWidget {
@override
Widget build(BuildContext context) {
// TODO: implement build
return new Scaffold(
appBar: AppBar(
title: Text("抽屉组件示例"),
),
drawer: Drawer(
child: ListView(
children: <Widget>[
//设置用户头像 用户名等等
UserAccountsDrawerHeader(
accountName: Text('邢伟新'),
accountEmail: Text('xwx3135@126.com'),
currentAccountPicture: CircleAvatar(
backgroundImage: AssetImage("images/1.jpeg"),
),
onDetailsPressed: () {},
otherAccountsPictures: <Widget>[
new Container(
child: Image.asset('images/code.jpeg'),
)
],
),
ListTile(
leading: CircleAvatar(
child: Icon(Icons.color_lens),
),
title: Text('个性装扮'),
),
ListTile(
leading: CircleAvatar(
child: Icon(Icons.phone),
),
title: Text("我的相册"),
),
ListTile(
leading: CircleAvatar(
child: Icon(Icons.wifi),
),
title: Text("免流量特权"),
),
],
),
),
);
}
}
效果图
网友评论