add the keyboard control

This commit is contained in:
Siyi Guo committed 2023-04-13 14:04:40 +08:00
1 parent dea0bccedf
commit 6faf8ed0bb
2 files changed
+50 -15

No files matched your search

+4 -2
View File
@@ -28,6 +28,7 @@ class _ImagePageState extends State<ImagePage> with WindowListener {
double offsetDy1 = 0;
double offsetDx2 = 0;
double offsetDy2 = 0;
var windowFocusNode = FocusNode(canRequestFocus: false);
@override
Widget build(BuildContext context) {
@@ -83,7 +84,7 @@ class _ImagePageState extends State<ImagePage> with WindowListener {
moveChanged: (dx, dy) {
offsetDx1 = dx;
offsetDy1 = dy;
setState(() {});
// setState(() {});
},
dx: offsetDx1,
dy: offsetDy1,
@@ -96,7 +97,8 @@ class _ImagePageState extends State<ImagePage> with WindowListener {
moveChanged: (dx, dy) {
offsetDx2 = dx;
offsetDy2 = dy;
setState(() {});
windowFocusNode.unfocus();
// setState(() {});
},
dx: offsetDx2,
dy: offsetDy2,