-
Notifications
You must be signed in to change notification settings - Fork 27k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Image resolution changes when resizing window #115653
Comments
The video may be not obvious enough. But running the code will give a much more clear result. |
probably not a dupe, but maybe related to |
Yes, they are not dupe. This issue does not scale the picture, but resize the window. |
Hi @fufesou, kindly share the image you used in your repro. Can you also upgrade to the latest version of flutter stable (3.3.8) to see if you still experience this issue? Thank you |
Hi @danagbemava-nc . I've upgrade my flutter to 3.3.8. This issue exists. This picture can produce a more obvious result. chrome_AlJIUajhtS.mp4
|
I can reproduce the issue using the code sample provided above and the image in #115653 (comment). It seems like the bug occurs depending on the resolution of the screen being used as I could not reproduce this on the in-built display of my mac but it did reproduce on my external monitor. It also reproduced on my windows laptop which is not connected to an external display. Labeling for further insight from the team. recordingsWindowsblurring.mp4Dell 27" monitorScreen.Recording.2022-11-22.at.06.52.54.movBuilt-in Mac displayScreen.Recording.2022-11-22.at.06.28.15.movflutter doctor -v
|
@danagbemava-nc The image may fuzzy text when using custom paint and resizing the window. Linux - Flutter 3.3.9 and 3.6.0-10.0.pre Recordsvmplayer_6KCzQn1rjm.mp4Code sampleimport 'dart:io';
import 'dart:async';
import 'dart:ui' as ui;
import 'package:flutter/material.dart';
const useCustomPaint = true;
const imgPath = './12.png';
late ui.Image img;
void main() async {
WidgetsFlutterBinding.ensureInitialized();
img = await getImage(imgPath);
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
static const String _title = 'Flutter Code Sample';
@override
Widget build(BuildContext context) {
return MaterialApp(
title: _title,
home: Scaffold(
appBar: AppBar(title: const Text(_title)),
body: Center(
child: useCustomPaint
? CustomPaint(
size: Size(img.width.toDouble(), img.height.toDouble()),
painter: ImagePainter(image: img),
)
: Image.file(File(imgPath)),
),
),
);
}
}
Future<ui.Image> getImage(String path) async {
var completer = Completer<ImageInfo>();
var img = FileImage(File(path));
img
.resolve(const ImageConfiguration())
.addListener(ImageStreamListener((info, _) {
completer.complete(info);
}));
ImageInfo imageInfo = await completer.future;
return imageInfo.image;
}
class ImagePainter extends CustomPainter {
ImagePainter({
required this.image,
});
ui.Image? image;
@override
void paint(Canvas canvas, Size size) {
canvas.scale(1.0, 1.0);
var paint = Paint();
canvas.drawImage(image!, const Offset(0, 0), paint);
}
@override
bool shouldRepaint(CustomPainter oldDelegate) {
return true;
}
}
Set Logs
|
The |
Steps to Reproduce
Win10 Desktop, flutter 3.0.5 stable.
flutter run
on the code sampleExpected results:
There's no scale. The picture should be clear all the time.
Actual results:
Code_knJCbYOAag.mp4
Code sample
The picture is attached here.
Logs
The text was updated successfully, but these errors were encountered: