【问题标题】:How to Overlap Two Widgets in Flutter?如何在 Flutter 中重叠两个小部件?
【发布时间】:2019-05-21 05:34:18
【问题描述】:

预期输出:

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

当前输出:

代码:

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

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

图片路径:

assets/img/forex.png 

【问题讨论】:

标签: image flutter overlap


【解决方案1】:

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

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

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

  assets:
    - assets/

【讨论】:

    猜你喜欢
    • 2022-09-22
    • 2019-11-27
    • 2021-05-23
    • 2022-11-20
    • 2021-02-24
    • 2021-01-03
    • 2021-10-29
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多