image - 如何在 Flutter 中重叠两个小部件?

标签 image flutter overlap

预期输出:

This is a combination of a circle avatar with the color and and image on top of it

这是一个圆形头像与上面的颜色和图像的组合。

当前输出:

enter image description here

代码:

 leading: CircleAvatar(backgroundColor: contentWithIcon[value]['color']),

我如何将两者重叠在一起?

图片路径:

assets/img/forex.png 

最佳答案

您无需重叠它们或使用堆栈小部件,CircleAvatar 将为您处理。

CircleAvatar(backgroundColor: contentWithIcon[value]['color'], 
             child: Image.asset("assets/img/forex.png "),)

确保在 pubspec.yaml 中添加 assets 文件夹

  assets:
    - assets/

关于image - 如何在 Flutter 中重叠两个小部件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56231672/

相关文章:

iphone - 如何截取通过 iPhone 中的 MPMediaPlayerController 播放的视频?

Android 某些设备上的 Flutter local_auth 问题

flutter - 如何修复 flutter doctor 无法识别 Android 手机

firebase - 使用 Firebase 的 Flutter 中的 LinearProgressIndicator

javascript - 绘制点,以便它们在具有相同坐标时不会重叠

reactjs - react : check if elements in different components overlap

html - 如何在调整屏幕大小时将关闭按钮放置到弹出 div 的顶部而不让它四处移动

css - p :confirmDialog how to change the image and text color

java - 如何克隆图像?