flutter_web检测鼠标悬停,然后单击htmlelementview中
我正在使用Flutter Web来解析一些网站。 我需要检测鼠标悬停,然后单击htmlelementview,然后获取相应的元素。我试图听onmouseup(),但它不起作用。你能给我建议吗?
Widget myfunc(){
ui.platformViewRegistry.registerViewFactory(
'my-html',
(int viewId) => IFrameElement()
..style.border = 'none'
..srcdoc = webData
..onMouseUp.listen((event) {
print('onMouseUp => $event');
})
..onSelect.listen((event) {
print('onSelect => $event');
})
..onMouseDown.listen((event) {
print('onMouseDown=> $event');
})
..onMouseEnter.listen((event) {
print('onMouseEnter => $event');
})
);
return HtmlElementView(
viewType:'my-html',
);
}
我计划关注这篇文章以提取元素,但仅在HTMLElementView()之外使用。 如何获取所选文本或DART中的内html
I am using flutter web to parse some website.
I need to detect the mouse hover and click inside a htmlElementView and then get the corresponded element. I tried to listen the onMouseUp() but it didn't work. can you give me advise?
Widget myfunc(){
ui.platformViewRegistry.registerViewFactory(
'my-html',
(int viewId) => IFrameElement()
..style.border = 'none'
..srcdoc = webData
..onMouseUp.listen((event) {
print('onMouseUp => $event');
})
..onSelect.listen((event) {
print('onSelect => $event');
})
..onMouseDown.listen((event) {
print('onMouseDown=> $event');
})
..onMouseEnter.listen((event) {
print('onMouseEnter => $event');
})
);
return HtmlElementView(
viewType:'my-html',
);
}
I plan to follow this post to extract the element, but it only work outside of htmlElementView().
How to get the selected text or the inner html in Dart
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我没有发现什么问题,但我将遵循的解决方案作为替代方法。
我插入JavaScript,然后在飞镖一侧收听postmessage()。
步骤1。在HTML中添加Postmessage()。我解析整个Web HTML并插入活动。
步骤2。在飞镖一侧添加侦听器。
I don't find what is wrong but I use followed solution as an alternate.
I insert the JavaScript and listen to postMessage() on Dart side.
Step 1. add postMessage() in the HTML. I parse entire web HTML and insert the event.
Step 2. Add the listener on the Dart side.