Closed
Description
Flutter web cannot render high resolution images which are resolution aware. I am using Flutter to build web/mobile apps in one codebase for large clients at our consultancy so it's important that this issue gets fixed so that we can build a high-quality website.
Linked issues and other people facing issues:
#41328 - root cause identified
flutter/engine#17209 - hasn't fixed the issue
https://stackoverflow.com/questions/67716900/flutter-web-pictures-get-pixelated - stack overflow others facing issue (viewed 700+ times)
Root cause:
devicePixelRatio
in web is always 1 which means only the lowest resolution image will be rendered.
My app and code:
Note: you need to right click the above image and open in new tab to see pixelation issue (as the image is very small on Github). If i hardcode the path to a 2x or 3x image, the image looks crisp so it's definitely a problem. assets:
- assets/images/
- assets/images/2.0x/
- assets/images/3.0x/
Widget build(BuildContext context) {
final MediaQueryData queryData = MediaQuery.of(context);
double devicePixelRatio = queryData.devicePixelRatio;
print(devicePixelRatio); // Console prints devicePixelRatio on Web as 1
return ...
Image(
width: 412.w,
fit: BoxFit.fitWidth,
image: const AssetImage(
"assets/images/splash-doctors.png",
),
),
...
Metadata
Metadata
Assignees
Labels
Important issues not at the top of the work listLoading, displaying, rendering imagesIt was better in the past than it is nowFound to occur in 3.0Found to occur in 3.1flutter/packages/flutter repository. See also f: labels.The issue has been confirmed reproducible and is ready to work onIssue is closed as already fixed in a newer version