I need to draw a list of images with canvas, and I need that each image has a circular border: expected:
but what I implemented is:
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:
Please give me some help if you have any ideas.