jakky1 / webview_win_floating

Flutter webView for Windows. It's also a plugin that implements the interface of webview_flutter.
BSD 3-Clause "New" or "Revised" License
15 stars 7 forks source link

deactivate widget when navigating to another screen #21

Open ekuleshov opened 3 months ago

ekuleshov commented 3 months ago

When new route navigation is opened, such as new screen, the webview_win_floating floating widget is still staying on top of everything. I'm looking for a way to deactivate it when widget goes off screen and restore it back when you go back to the screen with the floating webview widget.

jakky1 commented 3 months ago

As I mentioned in README, the webview always show on top of all other widgets. This is limitation of this package.

To hide the webview, you can try to make the layout (i.e. left / top / width/ height ) of WebViewWidgetbe out of screen, such as make width / height = 0 , position out of screen , or replace WebViewWidget with Container().

// hide webview here
await Navigator.push();  // wait until new screen popped
// show webview here
ekuleshov commented 3 months ago

I wonder if that boilerplate code could be avoided with WebView widget handling something like reassemble() callback.

There is a similar/related issue. When you make a hot reload while running windows app under debugger while floating webview is shown. The web view is not being disposed and still shown after the hot reload, even that navigation and entire widget tree is completely reset.

jakky1 commented 3 months ago

I wonder if that boilerplate code could be avoided with WebView widget handling something like reassemble() callback.

I don't understand about this. Could you please explain with more details ?

About disposing all old webviews when hot-reload, I fix it and push new version 2.2.5 Please try again with new version.