Emam
Emam

Reputation: 173

BoxFit.fill shrinks the image,while BoxFit.Cover leads to hide some parts of the image

Ima trying to use an image in a circular shape, but it always leads to the issue of either cutting parts at the edge of the image, or shrinking the image in a bad way that is not good for the design...Have used DecorationImage, CircleAvatar, and ClipOval and all of them lead to the same issue. in case of boxFit.Cover

in case of boxFit.Fit

Upvotes: 1

Views: 910

Answers (2)

Franz
Franz

Reputation: 786

Use BoxFit.contain to keep the aspect ratio of the image and not cut out parts. It's like the combination of BoxFit.width and BoxFit.height.

Upvotes: 1

eamirho3ein
eamirho3ein

Reputation: 17940

Because you have issue with your image's width, you can use BoxFit.fitWidth. This would fit image from its width and cut it from its height.

Upvotes: 0

Related Questions