How can I improve image display quality? - flutter

Original image
Screenshot
When I try to load an image in my application, it feels like it is somehow not stretching properly.
I tried all the options for the "fit" parameter
And nothing happened
It's my code
SingleChildScrollView(
child: Container(
width: width,
child: Image.network(
'https://img4.manga-chan.me/manga/-9new/t/1568958338_the-gamer-tom-4-glava-290/001.png',
filterQuality: FilterQuality.high,
fit: BoxFit.cover,
),
),
)
What should I do to make the image of original quality?

Did it and it helped me
Wrapped scroll in container
double width = MediaQuery.of(context).size.width;
double height = MediaQuery.of(context).size.height;
Container(
width: width,
height: height,
child: SingleChildScrollView(
child: Image.network(
'https://img4.manga-chan.me/manga/-9new/t/1571807955_the-gamer-tom-4-glava-296/002.png',
filterQuality: FilterQuality.high,
fit: BoxFit.fitWidth,
),
),
)

Related

How to make a square video 1:1 without losing its aspect ration in Flutter with video_player package

Trying to crop the video of a video to display a preview as a square without changing its width and height.
This is how it makes a square video
Container(
width: 200, //Crop width
height: 200, //Crop height
child: FittedBox(
// alignment: Alignment.center, //Move around the crop
fit: BoxFit.cover,
clipBehavior: Clip.hardEdge,
child: SizedBox(
width: videoController.value.size.width,
height: videoController.value.size.height,
child: AspectRatio(
aspectRatio: videoController.value.aspectRatio,
child: VideoPlayer(
videoController,
),
),
),
),
);

Image gets shrinked when put inside Stack widget Flutter

My expected ui is to have the image occupy full width and have an text on top of it. So I an stack widget but it shrinks down and does not take complete width.
body: ListView(
children: [
Stack(
children: [
Container(
child: Image(
height:120.0,
image: AssetImage('images/business.jpg'),
),
),
Text("Business",style: TextStyle(fontSize: 30.0),)
],
)
])
First of all, I think there is no need for the ListView widget as far I know from looking at your code. Remove it and to achieve what you're looking for, add the below properties to the Image widget
fit: BoxFit.cover,
height: double.infinity,
width: double.infinity
so the final version should look like:
Image(
fit: BoxFit.cover,
height: double.infinity,
width: double.infinity
image: AssetImage('images/business.jpg'),
),

Make background a scrollable png for flutter

I am making a flutter website, where on mobile I would want to have a png image that fits the width of the device, but it keeps the ratio of the image, and makes it scrollable. This is my code:
child: Stack(children: [
SingleChildScrollView(
child: Container(
color: Colors.red,
width: width,
height: height,
child: DecoratedBox(
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage(mobileBackground),
fit: BoxFit.fitWidth),
)
//height: height,
),
),
),
This doesn't scroll though. Is there a way to fix this? Thanks.

How to display a part of a big image?

I got an image that is landscape and want to use it on my phone (portrait).
I don't want to resize my image. I just want to use what I need based on my screen size and start from the middle of it. And if I want to start from the left, what would be the solution?
I am not sure I am clear, so I created a basic image to explain what I meant.
Thanks
UPDATE
Scaffold(
body: Stack(
children: <Widget>[
Container(
decoration: BoxDecoration(
image: DecorationImage(
image:
const AssetImage("assets/images/login_960x540.png"),
fit: BoxFit.cover,
// colorFilter: ColorFilter.mode(
// Colors.black.withOpacity(0.3), BlendMode.dstATop),
),
),
),
#David You can use FittedBox and Alignment for positioning background image, for example:
Container(
height: 100,
width: 100,
child: FittedBox(
alignment: Alignment.centerLeft, //Positioned in start
fit: BoxFit.fitHeight,
child: Image.asset('assets/image.png'), //If image 100x300, you will see just 100x100
),
);

Flutter - Image taking the whole screen width

In a Detail page, I'd like an image to take the whole width available, on the very top. This is my code:
#override
Widget build(BuildContext context) {
return Scaffold(
body: Stack(
children: <Widget>[
Container(
child: Column(
children: <Widget>[
Container(
width: double.infinity,
child: Image.asset(
this.imageLink,
),
)
],
),
),
),
);
The problème is : with the emulator, the result is exactly what I want :
But when I launch the app on a real phone (Galaxy S8 Plus) there are some paddings (top, left and right) and the image doesn't fit the screen width.
Which means that something is not correct in the way I tried to do it with the code.
Where could be the problem ?
I think the reason being original width of image is equal or more than the width of emulator and which is less than your Samsung S8+ width, you need to use
Image.asset(
this.linkImage,
width: double.infinity,
fit: BoxFit.cover,
),
You will have use expanded widget for that or you can use
height: double.infinity,
width: double.infinity,
or
new Image.asset('assets/images/umbrella.png',
width: size.width,
height: size.height,
fit: BoxFit.fill,
)
you can use
fit: BoxFit.cover,