Reputation: 12433
I have a picture 640 * 400
For example if the mobile phone resolution is 1280 * 960
Widget background = new Positioned.fill(
child: Image.asset('images/back.png'),
right: 0,
left: 0
);
the picture is magnified to 640x400 -> 1280x800.
so there appears blank in the screen.
But in this case, I want to magnify to the 1536x960,
It can fill the screen without blank.
How can I make it?
Upvotes: 0
Views: 54
Reputation: 17756
Just set the fit
property of the Image
to BoxFit.cover
:
Positioned.fill(
child: Image.asset('images/back.png', fit: BoxFit.cover),
right: 0,
left: 0
);
Upvotes: 1