From 0e012894b5567009a5b4bc1346486ad6341e6adc Mon Sep 17 00:00:00 2001 From: fufesou Date: Fri, 5 Aug 2022 11:07:24 +0800 Subject: [PATCH] flutter_desktop: fix remote menu control and image scaling Signed-off-by: fufesou --- flutter/lib/desktop/pages/remote_page.dart | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/flutter/lib/desktop/pages/remote_page.dart b/flutter/lib/desktop/pages/remote_page.dart index ed62e5067..4672afe62 100644 --- a/flutter/lib/desktop/pages/remote_page.dart +++ b/flutter/lib/desktop/pages/remote_page.dart @@ -241,7 +241,7 @@ class _RemotePageState extends State super.build(context); Provider.of(context, listen: false).tabBarHeight = super.widget.tabBarHeight; - final pi = Provider.of(context).pi; + final hasDisplays = _ffi.ffiModel.pi.displays.length > 0; final hideKeyboard = isKeyboardShown() && _showEdit; final showActionButton = !_showBar || hideKeyboard; final keyboard = _ffi.ffiModel.permissions['keyboard'] != false; @@ -282,7 +282,7 @@ class _RemotePageState extends State } }); }), - bottomNavigationBar: _showBar && pi.displays.length > 0 + bottomNavigationBar: _showBar && hasDisplays ? getBottomAppBar(keyboard) : null, body: Overlay( @@ -878,7 +878,14 @@ class ImagePainter extends CustomPainter { void paint(Canvas canvas, Size size) { if (image == null) return; canvas.scale(scale, scale); - canvas.drawImage(image!, new Offset(x, y), new Paint()); + // https://github.com/flutter/flutter/issues/76187#issuecomment-784628161 + var paint = new Paint(); + if (scale > 1.00001) { + paint.filterQuality = FilterQuality.high; + } else if (scale < 0.99999) { + paint.filterQuality = FilterQuality.medium; + } + canvas.drawImage(image!, new Offset(x, y), paint); } @override