improve enter os password

This commit is contained in:
open-trade
2020-12-21 21:52:20 +08:00
parent 8455c69733
commit a238b6a10a
4 changed files with 40 additions and 30 deletions

View File

@@ -445,8 +445,8 @@ class CursorModel with ChangeNotifier {
void updateDisplayOrigin(double x, double y) {
_displayOriginX = x;
_displayOriginY = y;
_x = x;
_y = y;
_x = x + 1;
_y = y + 1;
FFI.moveMouse(x, y);
FFI.canvasModel.resetOffset();
notifyListeners();

View File

@@ -751,7 +751,7 @@ void showOptions(BuildContext context) {
}, () async => true, true, 0);
}
void showActions(BuildContext context) async {
void showActions(BuildContext context) {
final size = MediaQuery.of(context).size;
final x = 120.0;
final y = size.height;
@@ -763,7 +763,6 @@ void showActions(BuildContext context) async {
FFI.ffiModel.permissions['clipboard'] != false) {
more.add(PopupMenuItem<String>(child: Text('Paste'), value: 'paste'));
}
var password = await getPassword(FFI.id);
more.add(PopupMenuItem<String>(
child: Row(
children: ([
@@ -804,10 +803,21 @@ void showActions(BuildContext context) async {
}
}();
} else if (value == 'enter_os_password') {
if (password != "") {
FFI.setByName('input_string', password);
FFI.inputKey('VK_RETURN');
}
() async {
var password = await getPassword(FFI.id);
if (password != "") {
var x = FFI.cursorModel.x;
var y = FFI.cursorModel.y;
FFI.moveMouse(x + 3, y + 3);
await Future.delayed(Duration(milliseconds: 50));
FFI.moveMouse(x, y);
await Future.delayed(Duration(milliseconds: 50));
FFI.tap(true);
await Future.delayed(Duration(milliseconds: 300));
FFI.setByName('input_string', password);
FFI.inputKey('VK_RETURN');
}
}();
}
}();
}