From 56ee947e2c0a4f7c76a6bbc911c87882c228de02 Mon Sep 17 00:00:00 2001 From: fufesou Date: Sat, 26 Nov 2022 10:46:57 +0800 Subject: [PATCH] do not show scroll options when scale adaptive Signed-off-by: fufesou --- .../lib/desktop/widgets/remote_menubar.dart | 55 ++++++++++--------- 1 file changed, 30 insertions(+), 25 deletions(-) diff --git a/flutter/lib/desktop/widgets/remote_menubar.dart b/flutter/lib/desktop/widgets/remote_menubar.dart index 656dc8546..39c37dd8b 100644 --- a/flutter/lib/desktop/widgets/remote_menubar.dart +++ b/flutter/lib/desktop/widgets/remote_menubar.dart @@ -751,31 +751,6 @@ class _RemoteMenubarState extends State { dismissOnClicked: true, ), MenuEntryDivider(), - MenuEntryRadios( - text: translate('Scroll Style'), - optionsGetter: () => [ - MenuEntryRadioOption( - text: translate('ScrollAuto'), - value: kRemoteScrollStyleAuto, - dismissOnClicked: true, - ), - MenuEntryRadioOption( - text: translate('Scrollbar'), - value: kRemoteScrollStyleBar, - dismissOnClicked: true, - ), - ], - curOptionGetter: () async => - // null means peer id is not found, which there's no need to care about - await bind.sessionGetScrollStyle(id: widget.id) ?? '', - optionSetter: (String oldValue, String newValue) async { - await bind.sessionSetScrollStyle(id: widget.id, value: newValue); - widget.ffi.canvasModel.updateScrollStyle(); - }, - padding: padding, - dismissOnClicked: true, - ), - MenuEntryDivider(), MenuEntryRadios( text: translate('Image Quality'), optionsGetter: () => [ @@ -955,6 +930,36 @@ class _RemoteMenubarState extends State { MenuEntryDivider(), ]; + if (widget.state.viewStyle.value == kRemoteViewStyleOriginal) { + displayMenu.insert( + 2, + MenuEntryRadios( + text: translate('Scroll Style'), + optionsGetter: () => [ + MenuEntryRadioOption( + text: translate('ScrollAuto'), + value: kRemoteScrollStyleAuto, + dismissOnClicked: true, + ), + MenuEntryRadioOption( + text: translate('Scrollbar'), + value: kRemoteScrollStyleBar, + dismissOnClicked: true, + ), + ], + curOptionGetter: () async => + // null means peer id is not found, which there's no need to care about + await bind.sessionGetScrollStyle(id: widget.id) ?? '', + optionSetter: (String oldValue, String newValue) async { + await bind.sessionSetScrollStyle(id: widget.id, value: newValue); + widget.ffi.canvasModel.updateScrollStyle(); + }, + padding: padding, + dismissOnClicked: true, + )); + displayMenu.insert(3, MenuEntryDivider()); + } + if (_isWindowCanBeAdjusted(remoteCount)) { displayMenu.insert( 0,