From 138bfa9723a233e4ce15e06e8f9bdeeceb2eb9ef Mon Sep 17 00:00:00 2001 From: iven Date: Thu, 4 Jun 2026 09:22:48 +0800 Subject: [PATCH] =?UTF-8?q?fix(app):=20Flutter=20Web=20=E6=94=B9=E7=94=A8?= =?UTF-8?q?=20HTML=20=E6=B8=B2=E6=9F=93=E5=99=A8=EF=BC=8C=E9=81=BF?= =?UTF-8?q?=E5=85=8D=20Google=20Fonts=20CDN=20=E5=8A=A0=E8=BD=BD=E4=B8=AD?= =?UTF-8?q?=E6=96=87=E5=AD=97=E4=BD=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 根因: Flutter Web CanvasKit 渲染器会从 fonts.gstatic.com 按需加载 CJK 字体 woff2 子集,在中国网络环境下完全不可达。 修复: 启动参数添加 --web-renderer html,使用浏览器原生 CSS font-face 机制加载本地字体文件,无需外网访问。 面向中国国内市场,不依赖任何外部 CDN。 --- scripts/dev.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/dev.sh b/scripts/dev.sh index 7cc9680..446d8eb 100644 --- a/scripts/dev.sh +++ b/scripts/dev.sh @@ -153,7 +153,9 @@ start_app() { log_info "编译并启动 Flutter Web..." cd /g/nj/app - D:/flutter/bin/flutter.bat run -d chrome --web-port=$APP_PORT & + # --web-renderer html: 使用浏览器原生渲染,避免 CanvasKit 从 Google Fonts CDN 加载中文字体 + # 面向中国国内市场,不可依赖外部 CDN + D:/flutter/bin/flutter.bat run -d chrome --web-port=$APP_PORT --web-renderer html & log_info "等待学生端就绪..." for i in $(seq 1 30); do