From 163645ef8654cdae9e9ad3274d913181583c3bc2 Mon Sep 17 00:00:00 2001 From: fufesou Date: Sun, 14 Aug 2022 12:57:30 +0800 Subject: [PATCH] flutter_desktop: fix block user input action Signed-off-by: fufesou --- flutter/lib/desktop/pages/remote_page.dart | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/flutter/lib/desktop/pages/remote_page.dart b/flutter/lib/desktop/pages/remote_page.dart index 79f98f029..ceeb96049 100644 --- a/flutter/lib/desktop/pages/remote_page.dart +++ b/flutter/lib/desktop/pages/remote_page.dart @@ -257,7 +257,8 @@ class _RemotePageState extends State } }); }), - bottomNavigationBar: _showBar && hasDisplays ? getBottomAppBar() : null, + bottomNavigationBar: + _showBar && hasDisplays ? getBottomAppBar(ffiModel) : null, body: Overlay( initialEntries: [ OverlayEntry(builder: (context) { @@ -343,7 +344,7 @@ class _RemotePageState extends State child: child)))); } - Widget? getBottomAppBar() { + Widget? getBottomAppBar(FfiModel ffiModel) { return MouseRegion( cursor: SystemMouseCursors.basic, child: BottomAppBar( @@ -421,7 +422,7 @@ class _RemotePageState extends State icon: Icon(Icons.more_vert), onPressed: () { setState(() => _showEdit = false); - showActions(widget.id); + showActions(widget.id, ffiModel); }, ), ]), @@ -574,7 +575,7 @@ class _RemotePageState extends State return out; } - void showActions(String id) async { + void showActions(String id, FfiModel ffiModel) async { final size = MediaQuery.of(context).size; final x = 120.0; final y = size.height - super.widget.tabBarHeight; @@ -619,12 +620,8 @@ class _RemotePageState extends State await bind.getSessionToggleOption(id: id, arg: 'privacy-mode') != true) { more.add(PopupMenuItem( - child: Consumer( - builder: (_context, ffiModel, _child) => () { - return Text(translate( - (ffiModel.inputBlocked ? 'Unb' : 'B') + - 'lock user input')); - }()), + child: Text(translate( + (ffiModel.inputBlocked ? 'Unb' : 'B') + 'lock user input')), value: 'block-input')); } }