I have a sample code which detects a hovering stylus over a widget.
The code is from this Stackoverflow Quesion.
In short. It binds using GestureBinding.instance?.pointerRouter.addGlobalRoute
and checks in the handler if the event is of type stylus.
This gets triggered when the stylus is hovering over the screen (no contact).
It works great on Widgets like Text()
, Container()
etc.
Question:
I want to use this functionality on a different Widget, the Flutter InAppWebView
but the event will not get triggered until the pen has contact with the surface. Even on the Container it does not work, if the child is the InAppWebView
.
I think this problem will occur on other Widgets too.
I tried the Listener
, AbsorbPointer
and IgnorePointer
.
Update 1:
I can see the following in the debug output when I start hovering the stylus over the screen.
I/ViewRootImpl(23491): updatePointerIcon pointerType = 20001, calling pid = 23491
D/InputManager(23491): setPointerIconType iconId = 20001, callingPid = 23491
Update 2:
The InAppWebView has an option useHybridComposition
which is false
by default. Setting it to true
solves the issue. But the WebView is becoming very slow.
HERE is a repository that shows the problem.
Thanks!