workaround soft-keyboard's control_key trigger twice
This commit is contained in:
parent
d2a01a7240
commit
7fe8b2cee7
@ -37,8 +37,8 @@ class _RemotePageState extends State<RemotePage> {
|
|||||||
var _fn = false;
|
var _fn = false;
|
||||||
final FocusNode _mobileFocusNode = FocusNode();
|
final FocusNode _mobileFocusNode = FocusNode();
|
||||||
final FocusNode _physicalFocusNode = FocusNode();
|
final FocusNode _physicalFocusNode = FocusNode();
|
||||||
var _showEdit = false;
|
var _showEdit = false; // use soft keyboard
|
||||||
var _isPhysicalKeyboard = false;
|
var _isPhysicalMouse = false;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@ -258,7 +258,7 @@ class _RemotePageState extends State<RemotePage> {
|
|||||||
: SafeArea(
|
: SafeArea(
|
||||||
child: Container(
|
child: Container(
|
||||||
color: MyTheme.canvasColor,
|
color: MyTheme.canvasColor,
|
||||||
child: _isPhysicalKeyboard
|
child: _isPhysicalMouse
|
||||||
? getBodyForMobile()
|
? getBodyForMobile()
|
||||||
: getBodyForMobileWithGesture())));
|
: getBodyForMobileWithGesture())));
|
||||||
})
|
})
|
||||||
@ -271,36 +271,36 @@ class _RemotePageState extends State<RemotePage> {
|
|||||||
return Listener(
|
return Listener(
|
||||||
onPointerHover: (e) {
|
onPointerHover: (e) {
|
||||||
if (e.kind != ui.PointerDeviceKind.mouse) return;
|
if (e.kind != ui.PointerDeviceKind.mouse) return;
|
||||||
if (!_isPhysicalKeyboard) {
|
if (!_isPhysicalMouse) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_isPhysicalKeyboard = true;
|
_isPhysicalMouse = true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (_isPhysicalKeyboard) {
|
if (_isPhysicalMouse) {
|
||||||
FFI.handleMouse(getEvent(e, 'mousemove'));
|
FFI.handleMouse(getEvent(e, 'mousemove'));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onPointerDown: (e) {
|
onPointerDown: (e) {
|
||||||
if (e.kind != ui.PointerDeviceKind.mouse) {
|
if (e.kind != ui.PointerDeviceKind.mouse) {
|
||||||
if (_isPhysicalKeyboard) {
|
if (_isPhysicalMouse) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_isPhysicalKeyboard = false;
|
_isPhysicalMouse = false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (_isPhysicalKeyboard) {
|
if (_isPhysicalMouse) {
|
||||||
FFI.handleMouse(getEvent(e, 'mousedown'));
|
FFI.handleMouse(getEvent(e, 'mousedown'));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onPointerUp: (e) {
|
onPointerUp: (e) {
|
||||||
if (e.kind != ui.PointerDeviceKind.mouse) return;
|
if (e.kind != ui.PointerDeviceKind.mouse) return;
|
||||||
if (_isPhysicalKeyboard) {
|
if (_isPhysicalMouse) {
|
||||||
FFI.handleMouse(getEvent(e, 'mouseup'));
|
FFI.handleMouse(getEvent(e, 'mouseup'));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onPointerMove: (e) {
|
onPointerMove: (e) {
|
||||||
if (e.kind != ui.PointerDeviceKind.mouse) return;
|
if (e.kind != ui.PointerDeviceKind.mouse) return;
|
||||||
if (_isPhysicalKeyboard) {
|
if (_isPhysicalMouse) {
|
||||||
FFI.handleMouse(getEvent(e, 'mousemove'));
|
FFI.handleMouse(getEvent(e, 'mousemove'));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -344,7 +344,8 @@ class _RemotePageState extends State<RemotePage> {
|
|||||||
sendRawKey(e, down: true);
|
sendRawKey(e, down: true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (e is RawKeyUpEvent) {
|
// [!_showEdit] workaround for soft-keyboard's control_key like Backspace / Enter
|
||||||
|
if (!_showEdit && e is RawKeyUpEvent) {
|
||||||
if (key == LogicalKeyboardKey.altLeft ||
|
if (key == LogicalKeyboardKey.altLeft ||
|
||||||
key == LogicalKeyboardKey.altRight) {
|
key == LogicalKeyboardKey.altRight) {
|
||||||
FFI.alt = false;
|
FFI.alt = false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user