美文网首页
Flutter 抽屉组件

Flutter 抽屉组件

作者: 喜剧收尾_XWX | 来源:发表于2020-08-11 18:00 被阅读0次
    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("免流量特权"),
                ),
              ],
            ),
          ),
        );
      }
    }
    
    
    
    效果图

    相关文章

      网友评论

          本文标题:Flutter 抽屉组件

          本文链接:https://www.haomeiwen.com/subject/xcvydktx.html