如何在 Flutter 中重叠两个 Widget?

How to Overlap Two Widgets in Flutter?

预期输出:

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

当前输出:

代码:

 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/