flutter_desktop: fix block user input action

Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
fufesou 2022-08-14 12:57:30 +08:00
parent b731d8e38a
commit 163645ef86

View File

@ -257,7 +257,8 @@ class _RemotePageState extends State<RemotePage>
} }
}); });
}), }),
bottomNavigationBar: _showBar && hasDisplays ? getBottomAppBar() : null, bottomNavigationBar:
_showBar && hasDisplays ? getBottomAppBar(ffiModel) : null,
body: Overlay( body: Overlay(
initialEntries: [ initialEntries: [
OverlayEntry(builder: (context) { OverlayEntry(builder: (context) {
@ -343,7 +344,7 @@ class _RemotePageState extends State<RemotePage>
child: child)))); child: child))));
} }
Widget? getBottomAppBar() { Widget? getBottomAppBar(FfiModel ffiModel) {
return MouseRegion( return MouseRegion(
cursor: SystemMouseCursors.basic, cursor: SystemMouseCursors.basic,
child: BottomAppBar( child: BottomAppBar(
@ -421,7 +422,7 @@ class _RemotePageState extends State<RemotePage>
icon: Icon(Icons.more_vert), icon: Icon(Icons.more_vert),
onPressed: () { onPressed: () {
setState(() => _showEdit = false); setState(() => _showEdit = false);
showActions(widget.id); showActions(widget.id, ffiModel);
}, },
), ),
]), ]),
@ -574,7 +575,7 @@ class _RemotePageState extends State<RemotePage>
return out; return out;
} }
void showActions(String id) async { void showActions(String id, FfiModel ffiModel) async {
final size = MediaQuery.of(context).size; final size = MediaQuery.of(context).size;
final x = 120.0; final x = 120.0;
final y = size.height - super.widget.tabBarHeight; final y = size.height - super.widget.tabBarHeight;
@ -619,12 +620,8 @@ class _RemotePageState extends State<RemotePage>
await bind.getSessionToggleOption(id: id, arg: 'privacy-mode') != await bind.getSessionToggleOption(id: id, arg: 'privacy-mode') !=
true) { true) {
more.add(PopupMenuItem<String>( more.add(PopupMenuItem<String>(
child: Consumer<FfiModel>( child: Text(translate(
builder: (_context, ffiModel, _child) => () { (ffiModel.inputBlocked ? 'Unb' : 'B') + 'lock user input')),
return Text(translate(
(ffiModel.inputBlocked ? 'Unb' : 'B') +
'lock user input'));
}()),
value: 'block-input')); value: 'block-input'));
} }
} }