Created
February 2, 2020 08:41
-
-
Save ryanlid/8a8dca80b872cf0424198498bc95cfee to your computer and use it in GitHub Desktop.
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
import 'package:flutter/material.dart'; | |
void main() { | |
runApp(MyApp()); | |
} | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
title: "Drawer 抽屉示例", | |
home: Scaffold( | |
appBar: AppBar( | |
title: Text('Drawer 抽屉示例'), | |
), | |
body: Center( | |
child: Text('Drawer 抽屉示例'), | |
), | |
drawer: Drawer( | |
child: ListView( | |
children: <Widget>[ | |
UserAccountsDrawerHeader( | |
accountName: Text('一只大象'), | |
accountEmail: Text('one@daxiang.com'), | |
// 设置当前用户的头像 | |
currentAccountPicture: CircleAvatar( | |
backgroundImage: NetworkImage( | |
"https://static.lidong.me/upload/XjGwvaVAI.png", | |
)), | |
onDetailsPressed: () {}, | |
// 设置其它用户头像 | |
otherAccountsPictures: <Widget>[ | |
Container( | |
child: Image.network( | |
"https://static.lidong.me/upload/c7QdErvcb.png", | |
), | |
) | |
], | |
), | |
// 导航栏菜单 | |
ListTile( | |
leading: CircleAvatar( | |
child: Icon(Icons.color_lens), | |
), | |
title: Text("个性装扮"), | |
), | |
ListTile( | |
leading: CircleAvatar( | |
child: Icon(Icons.photo), | |
), | |
title: Text("我的相册"), | |
), | |
ListTile( | |
leading: CircleAvatar( | |
child: Icon(Icons.wifi), | |
), | |
title: Text("免流量特权"), | |
), | |
], | |
), | |
), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment