From b731d8e38ac91f583c454bc7544519bc76efeafa Mon Sep 17 00:00:00 2001 From: fufesou Date: Sun, 14 Aug 2022 12:48:04 +0800 Subject: [PATCH] flutter_desktop: disable scroll wheel event Signed-off-by: fufesou --- flutter/lib/desktop/pages/remote_page.dart | 64 +++++++--------------- 1 file changed, 20 insertions(+), 44 deletions(-) diff --git a/flutter/lib/desktop/pages/remote_page.dart b/flutter/lib/desktop/pages/remote_page.dart index b410969ca..79f98f029 100644 --- a/flutter/lib/desktop/pages/remote_page.dart +++ b/flutter/lib/desktop/pages/remote_page.dart @@ -906,54 +906,30 @@ class ImagePaint extends StatelessWidget { } Widget _buildCrossScrollbar(Widget child) { - debugPrint( - 'REMOVE ME ==================================== _buildCrossScrollbar ${cursorOverImage.value}'); - // final physicsVertical = - // cursorOverImage.value ? const NeverScrollableScrollPhysics() : null; - // final physicsHorizontal = - // cursorOverImage.value ? const NeverScrollableScrollPhysics() : null; - - if (cursorOverImage.value) { - return Scrollbar( - controller: _vertical, + final physicsVertical = + cursorOverImage.value ? const NeverScrollableScrollPhysics() : null; + final physicsHorizontal = + cursorOverImage.value ? const NeverScrollableScrollPhysics() : null; + return Scrollbar( + controller: _vertical, + thumbVisibility: true, + trackVisibility: true, + child: Scrollbar( + controller: _horizontal, thumbVisibility: true, trackVisibility: true, - child: Scrollbar( - controller: _horizontal, - thumbVisibility: true, - trackVisibility: true, - notificationPredicate: (notif) => notif.depth == 1, + notificationPredicate: (notif) => notif.depth == 1, + child: SingleChildScrollView( + controller: _vertical, + physics: physicsVertical, child: SingleChildScrollView( - controller: _vertical, - physics: const NeverScrollableScrollPhysics(), - child: SingleChildScrollView( - controller: _horizontal, - scrollDirection: Axis.horizontal, - physics: const NeverScrollableScrollPhysics(), - child: child, - ), + controller: _horizontal, + scrollDirection: Axis.horizontal, + physics: physicsHorizontal, + child: child, ), - )); - } else { - return Scrollbar( - controller: _vertical, - thumbVisibility: true, - trackVisibility: true, - child: Scrollbar( - controller: _horizontal, - thumbVisibility: true, - trackVisibility: true, - notificationPredicate: (notif) => notif.depth == 1, - child: SingleChildScrollView( - controller: _vertical, - child: SingleChildScrollView( - controller: _horizontal, - scrollDirection: Axis.horizontal, - child: child, - ), - ), - )); - } + ), + )); } Widget _buildListener(Widget child) {