flet
flet copied to clipboard
WebView do not show local html page
Duplicate Check
- [X] I have searched the opened issues and there are no duplicates
Describe the bug
I need to show local page "ticket.html" in WebView at Android app. I right simple code and build apk from Windows:
flet build apk --include-packages flet_webview --build-version "0.1.10" --verbose
APK build OK. I try to run at Android phone and see only grey(screenshot)
Code
import flet as ft
def main(page: ft.Page): wv = ft.WebView( url="ticket.html", expand=True, on_page_started=lambda _: print("Page started"), on_page_ended=lambda _: print("Page ended"), on_web_resource_error=lambda e: ft.Text(e.data), ) page.add(wv)
ft.app(main)
To reproduce
Save code at main.py, put near main.py simple ticket.html (with all tags like:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<meta http-equiv=Content-Type content="text/html; charset=utf-8">
<HTML>
<BODY>
<STYLE>
Build apk using:
flet build apk --include-packages flet_webview --build-version "0.1.10" --verbose
install and run apk on Android phone
Expected behavior
I try to change dir of ticket.html is:
- it was near main.py
- change code to use url from assets and copy at assets ticket.html
Screenshots
Operating System
Linux
Operating system details
Android 14
Flet version
0.22.1
Regression
I'm not sure / I don't know
Suggestions
No response
Additional details
No response