go-flutter-desktop / go-flutter

Flutter on Windows, MacOS and Linux - based on Flutter Embedding, Go and GLFW.
https://hover.build/
BSD 3-Clause "New" or "Revised" License
5.85k stars 283 forks source link

RawKeyboardListener not work after upgrading hover to 0.45 #535

Closed leedstyh closed 3 years ago

leedstyh commented 3 years ago

In hover 0.43 just works, what might be the problem

hover doctor

hover: Hover version v0.45.0 running on windows
hover: Sharing packaging tools
hover: darwin-bundle is supported
hover: Packaging darwin-dmg is not supported on windows
hover: To still package darwin-dmg on windows you need to run hover with the `--docker` flag.
hover: Packaging darwin-pkg is not supported on windows
hover: To still package darwin-pkg on windows you need to run hover with the `--docker` flag.
hover: Packaging linux-appimage is not supported on windows
hover: To still package linux-appimage on windows you need to run hover with the `--docker` flag.
hover: Packaging linux-deb is not supported on windows
hover: To still package linux-deb on windows you need to run hover with the `--docker` flag.
hover: Packaging linux-pkg is not supported on windows
hover: To still package linux-pkg on windows you need to run hover with the `--docker` flag.
hover: Packaging linux-rpm is not supported on windows
hover: To still package linux-rpm on windows you need to run hover with the `--docker` flag.
hover: Packaging linux-snap is not supported on windows
hover: To still package linux-snap on windows you need to run hover with the `--docker` flag.
hover: To package windows-msi these tools are required: candle
hover: Install the WiX Toolset from https://wixtoolset.org/releases/
hover: To still package windows-msi without the required tools installed you need to run hover with the `--docker` flag.
hover:
hover: Sharing flutter version
Flutter 1.23.0-18.1.pre • channel beta • https://github.com/flutter/flutter.git
Framework • revision 198df796aa (3 weeks ago) • 2020-10-15 12:04:33 -0700
Engine • revision 1d12d82d9c
Tools • Dart 2.11.0 (build 2.11.0-213.1.beta)
hover: Flutter engine commit: https://github.com/flutter/engine/commit/1d12d82d9cb54876f58044aa52198d53ec841c3d
hover: Finding out the C compiler version
gcc (tdm64-1) 9.2.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

hover: Sharing the content of go.mod
module client/go

go 1.14

require (
        github.com/Xuanwo/go-locale v1.0.0 // indirect
        github.com/adrg/xdg v0.2.1
        github.com/go-flutter-desktop/go-flutter v0.42.0
        github.com/go-gl/glfw/v3.3/glfw v0.0.0-20201101223321-f087fae2c024 // indirect
        github.com/kr/pretty v0.1.0 // indirect
        github.com/pkg/errors v0.9.1
        golang.org/x/sys v0.0.0-20201101102859-da207088b7d1 // indirect
        golang.org/x/text v0.3.4 // indirect
        gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect
)
hover: Sharing the content of hover.yaml
application-name: CH Trader
executable-name: ""
package-name: ""
license: ""
target: lib/main.dart
branch: ""
cache-path: ""
opengl: ""
engine-version: ""
hover: Sharing the content of go/cmd
go\cmd\main.go  go\cmd\options.go       go\cmd\path_provider.go
pchampio commented 3 years ago

The hover version shouldn't interfere with the go-flutter version or how this specific feature works. I don't see why changing the build tool reflects an change in how RawKeyboardListener works.

please run: GO111MODULE=on go get -u github.com/go-flutter-desktop/hover In the https://github.com/go-flutter-desktop/examples/tree/master/keyboard_event example. hover bumpversion hover build windows --debug Does ./go/build/outputs/windows-debug_unopt/keyboard_event works ?

leedstyh commented 3 years ago

Thanks @pchampio , after reading the example code, I found the issue, maybe it's FocusNode related:

My code just put RawKeyboardListener in a StatelessWidget and without setting the autofocus = true. It works in 0.43.0 but not in 0.45.0

In 0.45.0, Setting autofocus = true fix this isse. Or put in a StatefullWidget with didChangeDependencies()