Search code examples
imageflutteroverlap

How to Overlap Two Widgets in Flutter?


Expected output:

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

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

Current output:

enter image description here

Code:

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

How do i overlap both on top of each other?

image path:

assets/img/forex.png 

Solution

  • You don't need to overlap them or use the stack widget, CircleAvatar will handle this for you.

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

    be sure assets folder is added in pubspec.yaml

      assets:
        - assets/