optimize the use exciress

This commit is contained in:
Siyi Guo committed 2023-04-13 19:18:32 +08:00
1 parent ba642e21d0
commit 70f87c73fc
1 file changed
+8 -5
+8 -5
View File
@@ -31,12 +31,12 @@ class _DraggableAreaState extends State<DraggableArea> {
bool isPressShift = false;
Axis? get axis {
if (isPressCommand) {
return Axis.vertical;
}
if (isPressShift) {
return Axis.horizontal;
}
if (isPressCommand) {
return Axis.vertical;
}
return null;
}
@@ -101,8 +101,11 @@ class _DraggableAreaState extends State<DraggableArea> {
setState(() {});
}
if (value is KeyUpEvent && isShift(value)) {
isPressShift = false;
setState(() {});
Future.delayed(const Duration(milliseconds: 500)).then((value) {
isPressShift = false;
if (!mounted) return;
setState(() {});
});
}
if (value is! KeyDownEvent && value is! KeyRepeatEvent) {
return KeyEventResult.ignored;