Flutter自定义 Drawer 弹出的ico 网络图片

创建Drawer的时候默认图标不能满足我们需求的时候 可以使用自定义图标

1,使用自定义图标

	appBar: AppBar(
	          leading: Builder(builder: (BuildContext context) {
	            return IconButton(
	              icon: const Icon(Icons.face),
	              onPressed: (){
	                Scaffold.of(context).openDrawer();
	              },
	            );
	          }),
	          title: Text(title),
	        ),

2,使用网络加载图标

appBar: AppBar(
	      leading: Builder(builder: (BuildContext context) {
            return IconButton(

              icon: new Container(
                padding: EdgeInsets.all(3.0),
                child: new CircleAvatar(
                  radius: 30.0,
                  backgroundImage: new NetworkImage('https://upload.jianshu.io/users/upload_avatars/7700793/dbcf94ba-9e63-4fcf-aa77-361644dd5a87?imageMogr2/auto-orient/strip|imageView2/1/w/240/h/240'),
                ),
              ),
              onPressed: () {
                Scaffold.of(context).openDrawer();
              },
            );
          }),
	          title: Text(title),
	        ),


参考
https://blog.csdn.net/M_zoneL/article/details/86669521

关注微信公众号获取更多内容

你可能感兴趣的:(Flutter)