Skip to content

Conversation

@SKbarbon
Copy link
Contributor

@SKbarbon SKbarbon commented Sep 23, 2023

This pull request includes updates for both the Flet Flutter package and the Flet Python SDK. These updates introduce support for a WebView control on mobile platforms (iOS and Android) through the class named MobileWebViewer.

peek

Screen.Recording.2023-09-23.at.1.43.00.PM.mov

code example

import flet

def main (page:flet.Page):
    page.appbar = flet.AppBar(
        title=flet.Text("WebView in flet!")
    )

    wv = flet.MobileWebViewer("http://localhost:3000/", width=400, height=650)
    page.add(wv)

flet.app(target=main)

desktop suggestion

I propose we distinguish between WebView components for desktop and mobile platforms. Typically, desktop WebView contains tools tailored for desktop-class functionality, which may not be accessible on mobile due to its limited capabilities. Merging these two types of WebView may constrain the capabilities of the desktop WebView widget. To address this, I recommend intentionally separating them by naming the desktop WebView as DesktopWebViewer and keeping the mobile version as MobileWebViewer. This deliberate separation will help maintain the distinct features and capabilities of each platform.

@SKbarbon
Copy link
Contributor Author

This Pull Request is related to flet website Pull Request:
flet-dev/website#157

@FeodorFitsner
Copy link
Contributor

Thanks for the PR!

CI is failing though - could you please take a look: https://ci.appveyor.com/project/flet-dev/flet/build/job/klmymruxukgofl60

@SKbarbon
Copy link
Contributor Author

@FeodorFitsner oopps 🙂, any help please or suggestions from your side 👀?

@FeodorFitsner
Copy link
Contributor

The problem is in https://pub.dev/packages/webview_universal package which prevents Linux client from building. What is that package for?

@SKbarbon
Copy link
Contributor Author

@FeodorFitsner you are right, this is an unnecessary dependency. I did remove it.

@FeodorFitsner
Copy link
Contributor

Thank you! Now I'd like to propose a name change for better consistency. Like in the title of this PR control is called MobileWebView, but in code it's called MobileWebViewer. I suggest we rename it to MobileWebView.

And I'm still not sure whether we should separate them into Mobile and Desktop WebViews. Like in control help doc you are referring to DesktopWebView (which does not exist yet). But what about WebWebView control? Is it for desktop or mobile?

So, I think we should call it just WebView and in the future deal with desktop and mobile differences.

@SKbarbon
Copy link
Contributor Author

@FeodorFitsner thank you for your response!
Thats totally fine if you see that its better to just make one webview. But one of the reasons for the separating is the lack of the "universal support" for the webview. But you can absolutely decide to not do that.

Eventually, this is was for me just as an experiment to see how flet works from the inside and making like a demo to my self for future contributs.

I really can't thank you enough for your great work at flet.

@FeodorFitsner
Copy link
Contributor

Good, let's rename it to WebView then. Also, you've probably accidentally copied some common types, please take a look: https://github.com/flet-dev/flet/pull/1865/files#diff-6e4a6372eebf7c2735b0ebd75aad81982e34497a86345f1a591d96b50f256c25R28-R70

@SKbarbon
Copy link
Contributor Author

ok @FeodorFitsner , How does it works then now? Close this Pull Request and start a new one? Or just rename this Pull Request and push new commit for the universal webview support with fixing the issues you marked?

@FeodorFitsner
Copy link
Contributor

Just rename PR and push new commit(s).

@SKbarbon SKbarbon changed the title Supporting MobileWebView control Supporting WebView control Oct 5, 2023
@SKbarbon
Copy link
Contributor Author

SKbarbon commented Oct 5, 2023

Hello @FeodorFitsner ,
I did all the steps you did ask.

  1. ✅ Rename the PR name to update the control name into WebView.
  2. ✅ Rename the control name in the python sdk to be WebView instead of MobileWebViewer.
  3. ✅ Rename the widget name in the dart (flutter) side to be WebView instead of MobileWebViewer.
  4. ✅ Remove all the unnecessary types.

Hope we go more further about this PR, accepting this a current mobile control widget, then do more researches maybe in another PR for making it more universal.

@FeodorFitsner FeodorFitsner changed the base branch from main to webview November 8, 2023 18:06
@FeodorFitsner FeodorFitsner merged commit 6a06bfc into flet-dev:webview Nov 8, 2023
@FeodorFitsner FeodorFitsner mentioned this pull request Nov 8, 2023
FeodorFitsner added a commit that referenced this pull request Nov 9, 2023
* Supporting `WebView` control (#1865)

* Supporting WebView for mobile.

* update `MobileWebViewer` with document

* remove Unnecessary flutter dependency

* Update `MobileWebView` to become `WebView`

As Discussed in the PR, we will make the WebView Universal instead of Separating for each platform.

* Update python SDK to support the updates about the `WebView`

---------

Co-authored-by: Feodor Fitsner <feodor@appveyor.com>

* Added `--host` option to `flet run` command.

* WebView control

---------

Co-authored-by: Kot <86029286+SKbarbon@users.noreply.github.com>
zrr1999 pushed a commit to zrr1999/flet that referenced this pull request Jul 17, 2024
* Supporting `WebView` control (flet-dev#1865)

* Supporting WebView for mobile.

* update `MobileWebViewer` with document

* remove Unnecessary flutter dependency

* Update `MobileWebView` to become `WebView`

As Discussed in the PR, we will make the WebView Universal instead of Separating for each platform.

* Update python SDK to support the updates about the `WebView`

---------

Co-authored-by: Feodor Fitsner <feodor@appveyor.com>

* Added `--host` option to `flet run` command.

* WebView control

---------

Co-authored-by: Kot <86029286+SKbarbon@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants