【问题标题】:CircleAvatar flutter not fit the image inside the circleCircleAvatar 颤动不适合圆圈内的图像
【发布时间】:2020-04-30 22:03:40
【问题描述】:

请帮忙,我需要在circleAvatar 小部件中放一张图片,但图片显示不完美。

此问题,仅在安卓设备上显示

                     return Center(
                        child: CircleAvatar(
                          radius: 100.0,
                          backgroundImage: ExactAssetImage(
                            'assets/images/ic_Photo-L.png',
                          ),
                        ),
                      );

【问题讨论】:

  • "but the image doesn't show prefectly" - 你的意思是什么?
  • 对不起,这是我的意思的链接。 i.stack.imgur.com/T2DNJ.png
  • Center( child: CircleAvatar(radius: 100.0, backgroundImage: NetworkImage('https://cdn.sstatic.net/Img/ico-binoculars.svg?v=d4dbaac4eec9')), ),
  • 对不起。不工作
  • 结果还是和这个i.stack.imgur.com/T2DNJ.png一样

标签: user-interface flutter mobile dart


【解决方案1】:

如果 CircleAvatar 不是强制性的,请尝试使用 ClipOval with Container

 return Center(
      child: ClipOval(
        child: Container(
          height: 200,
          width: 200,
          color: Colors.grey.shade200,
          child: Image.asset(
            'assets/images/ic_Photo-L.png',
            width: 200.0,
            height: 200.0,
            fit: BoxFit.contain,
          ),
        ),
      )
    );

【讨论】:

    猜你喜欢
    • 2021-10-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-05-25
    • 1970-01-01
    • 2023-02-03
    • 2015-06-09
    • 1970-01-01
    相关资源
    最近更新 更多