ClipRect可以用来裁剪容器内部的子元素,以避免超出容器的范围而溢出。常见的应用场景有:
child: ClipRRect( child: Image( image: AssetImage('images/edge.png'), fit: BoxFit.cover, width: 100, height: 100, ), borderRadius: BorderRadius.circular(50), ),
child: CircleAvatar( backgroundColor: Colors.white, backgroundImage: AssetImage('images/edge.png'), //半径越大,图片越大 radius: 50, ),
Container( width: 100, height: 100, decoration: BoxDecoration( color: Colors.white, image: DecorationImage( image: AssetImage('images/edge.png'), fit: BoxFit.cover), shape: BoxShape.circle), ),
Copyright © 2023 leiyu.cn. All Rights Reserved. 磊宇云计算 版权所有 许可证编号:B1-20233142/B2-20230630 山东磊宇云计算有限公司 鲁ICP备2020045424号
磊宇云计算致力于以最 “绿色节能” 的方式,让每一位上云的客户成为全球绿色节能和降低碳排放的贡献者