fix image blurry

Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
fufesou 2022-11-30 22:56:22 +08:00
parent efc9f312e9
commit c0cf6c3173

View File

@ -413,8 +413,12 @@ class _ImagePaintState extends State<ImagePaint> {
); );
} else { } else {
widget = Row( widget = Row(
mainAxisAlignment: MainAxisAlignment.center, children: [
children: [widget], Container(
width: ((layoutSize.width - size.width) ~/ 2).toDouble(),
),
widget,
],
); );
} }
if (layoutSize.height < size.height) { if (layoutSize.height < size.height) {
@ -430,8 +434,12 @@ class _ImagePaintState extends State<ImagePaint> {
); );
} else { } else {
widget = Column( widget = Column(
mainAxisAlignment: MainAxisAlignment.center, children: [
children: [widget], Container(
height: ((layoutSize.height - size.height) ~/ 2).toDouble(),
),
widget,
],
); );
} }
if (layoutSize.width < size.width) { if (layoutSize.width < size.width) {
@ -576,7 +584,8 @@ class ImagePainter extends CustomPainter {
paint.filterQuality = FilterQuality.high; paint.filterQuality = FilterQuality.high;
} }
} }
canvas.drawImage(image!, Offset(x, y), paint); canvas.drawImage(
image!, Offset(x.toInt().toDouble(), y.toInt().toDouble()), paint);
} }
@override @override