当前位置:   article > 正文

Flutter 圆形头像的几种实现方式_flutter boxshape

flutter boxshape

圆形头像

  • ClipOval

  1. new ClipOval(
  2. child: Image.asset("assets/images/home/xingbiao.png",fit: BoxFit.fill),
  3. )
  • CircleAvatar

  1. CircleAvatar(
  2. radius: 36.0,
  3. backgroundImage: AssetImage(
  4. "assets/images/home/xingbiao.png",
  5. ),
  6. )
  • BoxDecoration BoxShape.circle

  1. Container(
  2. width: 72.0,
  3. height: 72.0,
  4. decoration: BoxDecoration(
  5. shape: BoxShape.circle,
  6. image: DecorationImage(
  7. image: AssetImage(
  8. "assets/images/home/xingbiao.png",
  9. ),
  10. ),
  11. ),
  12. )

圆角头像

  • ClipRRect

  1. ClipRRect(
  2. borderRadius: BorderRadius.circular(6.0),
  3. child: new Image.asset("assets/images/home/xingbiao.png"),
  4. )
  • BoxDecoration BoxShape.rectangle

  1. Container(
  2. width: 88.0,
  3. height: 88.0,
  4. decoration: BoxDecoration(
  5. shape: BoxShape.rectangle,
  6. borderRadius: BorderRadius.circular(6.0),
  7. image: DecorationImage(
  8. image: AssetImage(
  9. "assets/images/home/xingbiao.png",
  10. ),
  11. ),
  12. ),

 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/我家自动化/article/detail/289637
推荐阅读
相关标签
  

闽ICP备14008679号