Reputation: 311
If I have an image like this :
Column(
children: [
Container(
child: Image.asset( //this image
file,
fit: BoxFit.fill,
),
),
_buildContents(),
],
),
And I want to have this image 1.5x times or 1.2x times bigger (or smaller) without exceeding in width or height, how can I do? (Keeping original proportions safe).
Upvotes: 0
Views: 359
Reputation: 1400
You can also use LayoutBuilder widget and depending on the constraint that provides the LayoutBuilder widget specify the size your image
Upvotes: 0
Reputation: 2974
You should use remove fit: BoxFit.fill
since it'll distort the image as per the documentation:
BoxFit.fill: Fill the target box by distorting the source's aspect ratio.
You can safely scale the image using Transform.scale
inside the Column such as:
Transform.scale(
scale: 1.50,
child: Image.asset(
file,
)
),
Upvotes: 2