From 414ac950e07de4b74e5f1ec519b5cd7c52869034 Mon Sep 17 00:00:00 2001 From: 21pages Date: Thu, 23 Nov 2023 19:17:19 +0800 Subject: [PATCH] don't show os password when don't have keyboard permission Signed-off-by: 21pages --- flutter/lib/common/widgets/toolbar.dart | 50 +++++++++++++------------ 1 file changed, 26 insertions(+), 24 deletions(-) diff --git a/flutter/lib/common/widgets/toolbar.dart b/flutter/lib/common/widgets/toolbar.dart index 2789bc6b8..2ff3419ab 100644 --- a/flutter/lib/common/widgets/toolbar.dart +++ b/flutter/lib/common/widgets/toolbar.dart @@ -88,32 +88,34 @@ List toolbarControls(BuildContext context, String id, FFI ffi) { ); } // osAccount / osPassword - v.add( - TTextMenu( - child: Row(children: [ - Text(translate(pi.isHeadless ? 'OS Account' : 'OS Password')), - ]), - trailingIcon: Transform.scale( - scale: isDesktop ? 0.8 : 1, - child: IconButton( - onPressed: () { - if (isMobile && Navigator.canPop(context)) { - Navigator.pop(context); - } - if (pi.isHeadless) { - showSetOSAccount(sessionId, ffi.dialogManager); - } else { - handleOsPasswordEditIcon(sessionId, ffi.dialogManager); - } - }, - icon: Icon(Icons.edit, color: isMobile ? MyTheme.accent : null), + if (perms['keyboard'] != false) { + v.add( + TTextMenu( + child: Row(children: [ + Text(translate(pi.isHeadless ? 'OS Account' : 'OS Password')), + ]), + trailingIcon: Transform.scale( + scale: isDesktop ? 0.8 : 1, + child: IconButton( + onPressed: () { + if (isMobile && Navigator.canPop(context)) { + Navigator.pop(context); + } + if (pi.isHeadless) { + showSetOSAccount(sessionId, ffi.dialogManager); + } else { + handleOsPasswordEditIcon(sessionId, ffi.dialogManager); + } + }, + icon: Icon(Icons.edit, color: isMobile ? MyTheme.accent : null), + ), ), + onPressed: () => pi.isHeadless + ? showSetOSAccount(sessionId, ffi.dialogManager) + : handleOsPasswordAction(sessionId, ffi.dialogManager), ), - onPressed: () => pi.isHeadless - ? showSetOSAccount(sessionId, ffi.dialogManager) - : handleOsPasswordAction(sessionId, ffi.dialogManager), - ), - ); + ); + } // paste if (isMobile && perms['keyboard'] != false && perms['clipboard'] != false) { v.add(TTextMenu(