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; bool isPressShift = false;
Axis? get axis { Axis? get axis {
if (isPressCommand) {
return Axis.vertical;
}
if (isPressShift) { if (isPressShift) {
return Axis.horizontal; return Axis.horizontal;
} }
if (isPressCommand) {
return Axis.vertical;
}
return null; return null;
} }
@@ -101,8 +101,11 @@ class _DraggableAreaState extends State<DraggableArea> {
setState(() {}); setState(() {});
} }
if (value is KeyUpEvent && isShift(value)) { if (value is KeyUpEvent && isShift(value)) {
isPressShift = false; Future.delayed(const Duration(milliseconds: 500)).then((value) {
setState(() {}); isPressShift = false;
if (!mounted) return;
setState(() {});
});
} }
if (value is! KeyDownEvent && value is! KeyRepeatEvent) { if (value is! KeyDownEvent && value is! KeyRepeatEvent) {
return KeyEventResult.ignored; return KeyEventResult.ignored;