防采集标记:亢少军老师的课程和资料

import 'package:flutter/material.dart';

void main() => runApp(
  new MaterialApp(
    title: 'Drawer抽屉组件示例',
    home: new LayoutDemo(),
  ),
);

class LayoutDemo extends StatelessWidget {

  @override
  Widget build(BuildContext context) {

    return new Scaffold(
      appBar: AppBar(
        title: Text('Drawer抽屉组件示例'),
      ),
      drawer: Drawer(
        child: ListView(
          children: [
            //设置用户信息 头像、用户名、Email等
            UserAccountsDrawerHeader(
              accountName: new Text(
                "玄微子",
              ),
              accountEmail: new Text(
                "[email protected]",
              ),
              //设置当前用户头像
              currentAccountPicture: new CircleAvatar(
                backgroundImage: new AssetImage("images/1.jpeg"),
              ),
              onDetailsPressed: () {},
              //属性本来是用来设置当前用户的其他账号的头像 这里用来当QQ二维码图片展示
              otherAccountsPictures: [
                new Container(
                  child: Image.asset('images/code.jpeg'),
                ),
              ],
            ),
            ListTile(
              leading: new CircleAvatar(child: Icon(Icons.color_lens)),//导航栏菜单
              title: Text('个性装扮'),
            ),
            ListTile(
              leading: new CircleAvatar(child: Icon(Icons.photo)),
              title: Text('我的相册'),
            ),
            ListTile(
              leading: new CircleAvatar(child: Icon(Icons.wifi)),
              title: Text('免流量特权'),
            ),
          ],
        ),
      ),
    );

  }
}




@作者: 亢少军

第5章MaterialDesign风格组件-Drawer抽屉组件

相关文章:

  • 2021-06-22
  • 2021-06-04
  • 2021-12-14
  • 2021-06-26
  • 2021-07-08
  • 2021-09-10
  • 2021-12-02
  • 2022-12-23
猜你喜欢
  • 2021-09-07
  • 2021-05-24
  • 2021-07-10
  • 2021-08-17
  • 2021-07-11
  • 2021-05-09
相关资源
相似解决方案