0

I need to draw a list of images with canvas, and I need that each image has a circular border: expected:

enter image description here

but what I implemented is:

enter image description here

my code is:

 for (int i = 0; i < participants.length; i++) {
    Completer<ui.Image> completer = Completer<ui.Image>();
    Image networkImage = Image.network(participants[i]?.avatar ?? "");
    networkImage.image
        .resolve(const ImageConfiguration())
        .addListener(ImageStreamListener((ImageInfo info, bool _) {
      canvas.drawImageNine(info.image, const Rect.fromLTRB(0, 0, 0, 0),
          Rect.fromLTRB(10+(i*20), 50, (participants.length * 20 )+ 50, 100), Paint());
      completer.complete(info.image);
    }));
  }

I use canvas.clipPath() before canvas.drawImage() too:

   Path path = Path()..addOval(const Rect.fromLTWH(10, 50, 50+(i*50), 50));
   canvas.clipPath(path);

it clipped whole the list:

enter image description here

Please give me some help if you have any ideas.

Parisa Baastani
  • 1,713
  • 14
  • 31

0 Answers0