From c0cf6c31738e15f3f85c71f341f7033d2646a9b0 Mon Sep 17 00:00:00 2001 From: fufesou Date: Wed, 30 Nov 2022 22:56:22 +0800 Subject: [PATCH] fix image blurry Signed-off-by: fufesou --- flutter/lib/desktop/pages/remote_page.dart | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/flutter/lib/desktop/pages/remote_page.dart b/flutter/lib/desktop/pages/remote_page.dart index bac80e7ac..7b3e0fe82 100644 --- a/flutter/lib/desktop/pages/remote_page.dart +++ b/flutter/lib/desktop/pages/remote_page.dart @@ -413,8 +413,12 @@ class _ImagePaintState extends State { ); } else { widget = Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [widget], + children: [ + Container( + width: ((layoutSize.width - size.width) ~/ 2).toDouble(), + ), + widget, + ], ); } if (layoutSize.height < size.height) { @@ -430,8 +434,12 @@ class _ImagePaintState extends State { ); } else { widget = Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [widget], + children: [ + Container( + height: ((layoutSize.height - size.height) ~/ 2).toDouble(), + ), + widget, + ], ); } if (layoutSize.width < size.width) { @@ -576,7 +584,8 @@ class ImagePainter extends CustomPainter { paint.filterQuality = FilterQuality.high; } } - canvas.drawImage(image!, Offset(x, y), paint); + canvas.drawImage( + image!, Offset(x.toInt().toDouble(), y.toInt().toDouble()), paint); } @override