I have an image (blue rect). I want to cut a part of the image by path (red triangle) and create a smaller widget (green rect) that shows this part of the image and has size which equals bounds of cutting path. How can I do it in Flutter?
I tried to use ClipPath
and CustomClipper<Path>
, but I was able to create only widget which has size of the image.
3
Answers
I found this solution:
since you are not provide any code, I assume you want to have widget based on current child.
if yes, you may try
IntrinsicWidth
andIntrinsicHeight
widget.https://api.flutter.dev/flutter/widgets/IntrinsicWidth-class.html
IntrinsicWidgth
:With this widget, the child will rendered with based on intrinsic size.
you can use
CustomPainter
with drawAtlas, performant, show part of the image. I use this to make animation like sprites Animation