Skip to content

An open-source remote desktop application designed for self-hosting, as an alternative to TeamViewer.

fix: popup menu, nav, pop (#8089)

fufesou72d59af7b042
diff --git a/flutter/lib/common/widgets/peer_tab_page.dart b/flutter/lib/common/widgets/peer_tab_page.dart
index ef44870c2..6b98b715f 100644
--- a/flutter/lib/common/widgets/peer_tab_page.dart
+++ b/flutter/lib/common/widgets/peer_tab_page.dart
@@ -341,7 +341,8 @@ class _PeerTabPageState extends State<PeerTabPage>
currentValue: model.isVisibleEnabled[tabIndex],
setter: (show) async {
model.setTabVisible(tabIndex, show);
- cancelFunc();
+ // Do not hide the current menu (checkbox)
+ // cancelFunc();
},
enabled: (!isOptVisiableFixed).obs));
}
@@ -821,6 +822,9 @@ class _PeerViewDropdownState extends State<PeerViewDropdown> {
k: kOptionPeerCardUiType,
v: peerCardUiType.value.index.toString(),
);
+ if (Navigator.canPop(context)) {
+ Navigator.pop(context);
+ }
}
}),
),
diff --git a/flutter/lib/desktop/widgets/popup_menu.dart b/flutter/lib/desktop/widgets/popup_menu.dart
index 1e15b74b0..da1a82835 100644
--- a/flutter/lib/desktop/widgets/popup_menu.dart
+++ b/flutter/lib/desktop/widgets/popup_menu.dart
@@ -450,6 +450,13 @@ abstract class MenuEntrySwitchBase<T> extends MenuEntryBase<T> {
RxBool get curOption;
Future<void> setOption(bool? option);
+ tryPop(BuildContext context) {
+ if (dismissOnClicked && Navigator.canPop(context)) {
+ Navigator.pop(context);
+ super.dismissCallback?.call();
+ }
+ }
+
@override
List<mod_menu.PopupMenuEntry<T>> build(
BuildContext context, MenuConfig conf) {
@@ -485,13 +492,7 @@ abstract class MenuEntrySwitchBase<T> extends MenuEntryBase<T> {
value: curOption.value,
onChanged: isEnabled
? (v) {
- if (super.dismissOnClicked &&
- Navigator.canPop(context)) {
- Navigator.pop(context);
- if (super.dismissCallback != null) {
- super.dismissCallback!();
- }
- }
+ tryPop(context);
setOption(v);
}
: null,
@@ -501,13 +502,7 @@ abstract class MenuEntrySwitchBase<T> extends MenuEntryBase<T> {
value: curOption.value,
onChanged: isEnabled
? (v) {
- if (super.dismissOnClicked &&
- Navigator.canPop(context)) {
- Navigator.pop(context);
- if (super.dismissCallback != null) {
- super.dismissCallback!();
- }
- }
+ tryPop(context);
setOption(v);
}
: null,
@@ -518,12 +513,7 @@ abstract class MenuEntrySwitchBase<T> extends MenuEntryBase<T> {
])),
onPressed: isEnabled
? () {
- if (super.dismissOnClicked && Navigator.canPop(context)) {
- Navigator.pop(context);
- if (super.dismissCallback != null) {
- super.dismissCallback!();
- }
- }
+ tryPop(context);
setOption(!curOption.value);
}
: null,