Flutter 圆角(四)CircleAvatar

@override
  Widget build(BuildContext context) {
    // TODO: implement build
    String imageNetwork = "http://pic41.nipic.com/20140514/5295460_234432363121_2.jpg";

    return Center(
      child: Container(width: 180, height: 180,
        //画一个(椭)圆的容器
        //如果父视图 有大小,那么按父视图的大小画椭圆
        //如果父视图没有大小,通过radius控制backgroundImage的大小
        child: CircleAvatar(
//          radius: 50,//半径,图形放大是radius的2倍
          //foregroundColor:子视图中文字的颜色
          //不设置backgroundColor和foregroundColor,CircleAvatar默认背景色是灰色
          //不设置backgroundColor,backgroundColor的颜色随foregroundColor变化而变化,但与foregroundColor色值不同
          //同时设置backgroundColor、backgroundImage,能直接看到的是backgroundImage
          foregroundColor: Colors.red,
          child: Text("flutter学习中。。。。"),
          backgroundColor: Colors.brown,
          backgroundImage: NetworkImage(imageNetwork),
        ),
      ),
    );
  }
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容