flet-dev / flet

Flet enables developers to easily build realtime web, mobile and desktop apps in Python. No frontend experience required.
https://flet.dev
Apache License 2.0
10.93k stars 421 forks source link

WebView do not show local html page #3460

Open MusienkoAnton opened 3 months ago

MusienkoAnton commented 3 months ago

Duplicate Check

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_pagestarted=lambda : print("Page started"), on_pageended=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:

  1. it was near main.py
  2. change code to use url from assets and copy at assets ticket.html

Screenshots

image

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

Muddassir-Farooq-official commented 1 day ago

Also facing same issue any solution