flet-dev / flet

Flet enables developers to easily build realtime web, mobile and desktop apps in Python. No frontend experience required.

Home Page:https://flet.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

In the absence of a network, some resources cannot be found in the browser, and desktop applications are good

NocoleNe opened this issue · comments

Description

ft.app ( target=main , view=ft.AppView.WEB_BROWSER )

The computer is not connected to the Internet. Run the above program in the local development environment, and only display a load icon in the browser,
The browser has the following resources that cannot be found:
https://www.gstatic.com/flutter-canvaskit/e76c956498841e1ab458577d3892003e553e4f3c/chromium/canvaskit.js net::ERR_NAME_NOT_RESOLVED

main.dart.js:10136

GET https://fonts.gstatic.com/s/roboto/v20/KFOmCnqEu92Fr1Me5WZLCzYlKw.ttf net::ERR_NAME_NOT_RESOLVED

main.dart.js:10136 Failed to load font Roboto at https://fonts.gstatic.com/s/roboto/v20/KFOmCnqEu92Fr1Me5WZLCzYlKw.ttf

main.dart.js:10136 Flutter Web engine failed to complete HTTP request to fetch "https://fonts.gstatic.com/s/roboto/v20/KFOmCnqEu92Fr1Me5WZLCzYlKw.ttf": TypeError: Failed to fetch

GET https://www.gstatic.com/flutter-canvaskit/e76c956498841e1ab458577d3892003e553e4f3c/canvaskit.js net::ERR_NAME_NOT_RESOLVED

main.dart.js:10136 Rejecting promise with error: Exception: Failed to download any of the following CanvasKit URLs: (https://www.gstatic.com/flutter-canvaskit/e76c956498841e1ab458577d3892003e553e4f3c/chromium/canvaskit.js, https://www.gstatic.com/flutter-canvaskit/e76c956498841e1ab458577d3892003e553e4f3c/canvaskit.js)

The computer can work normally when connected to the Internet,

Code example to reproduce the issue:

ft.app ( target=main , view=ft.AppView.WEB_BROWSER )

Describe the results you received:

Describe the results you expected:

Additional information you deem important (e.g. issue happens only occasionally):

Flet version (pip show flet):

Name: flet
Version: 0.22.0

Give your requirements.txt file (don't pip freeze, instead give direct packages):

just  the flet

Operating system:

Windows 10

Additional environment details:

Similar/related issue #2022.
In your case, the canvaskit web renderer (the default on web) is being used. Can you tell me what happens when you instead use the html renderer?

I haven't change anything in client\web\index.html
the resource KFOmCnqEu92Fr1Me5WZLCzYlKw.ttf and canvaskit.js file Reference occurs at build to web with canvas
detail in there
flutter/flutter#104399

Add the following selection during compilation:
--dart-define=FLUTTER_WEB_CANVASKIT_URL=/canvaskit/

There is another question about font files
When the browser page opens,
Before loading the KFomCnqEu92Fr1Me5WZLCzYlKw.ttf font file
Non English fonts will display garbled characters. When the font file is loaded, it will be displayed normally in just a few minutes

Similar/related issue #2022. In your case, the canvaskit web renderer (the default on web) is being used. Can you tell me what happens when you instead use the html renderer?

use the html renderer are ok