From f232c4d10aee2faf3fc8bab2537bb203e25c276d Mon Sep 17 00:00:00 2001 From: Booker Date: Fri, 12 Jun 2026 00:02:16 +0700 Subject: [PATCH] =?UTF-8?q?feat:=E8=B0=83=E6=95=B4=E4=BA=86=E5=90=AF?= =?UTF-8?q?=E5=8A=A8/=E9=A6=96=E5=B1=8F=E9=98=B6=E6=AE=B5=E7=9A=84=20WebVi?= =?UTF-8?q?ew=20=E5=92=8C=E5=A3=B3=E5=B1=82=20fallback=20=E5=B1=95?= =?UTF-8?q?=E7=A4=BA=EF=BC=9A=20WebView=20=E8=83=8C=E6=99=AF=E4=BB=8E?= =?UTF-8?q?=E7=99=BD=E8=89=B2=E6=94=B9=E6=88=90=E9=80=8F=E6=98=8E=E3=80=82?= =?UTF-8?q?=20WebView=20=E4=B8=8D=E5=86=8D=E6=97=A0=E6=9D=A1=E4=BB=B6?= =?UTF-8?q?=E6=B8=B2=E6=9F=93=EF=BC=8C=E5=8F=AA=E6=9C=89=E5=B7=B2=E5=8F=91?= =?UTF-8?q?=E8=B5=B7=E5=88=9D=E5=A7=8B=E5=8A=A0=E8=BD=BD=E6=88=96=E9=A6=96?= =?UTF-8?q?=E5=B1=8F=E5=B7=B2=E5=B1=95=E7=A4=BA=E5=90=8E=E6=89=8D=E6=B8=B2?= =?UTF-8?q?=E6=9F=93=E3=80=82=20=E9=A6=96=E5=B1=8F=E6=9C=AA=20ready=20?= =?UTF-8?q?=E6=97=B6=EF=BC=8C=E7=94=A8=20shell=20cover/fallback=20?= =?UTF-8?q?=E7=9B=96=E4=BD=8F=20WebView=EF=BC=8C=E9=81=BF=E5=85=8D?= =?UTF-8?q?=E7=99=BD=E5=B1=8F=E6=88=96=20WebView=20=E7=A9=BA=E7=99=BD?= =?UTF-8?q?=E5=B1=82=E6=8F=90=E5=89=8D=E9=9C=B2=E5=87=BA=E3=80=82=20?= =?UTF-8?q?=E9=A1=B6=E9=83=A8=E5=AE=89=E5=85=A8=E5=8C=BA=E8=83=8C=E6=99=AF?= =?UTF-8?q?=E8=89=B2=E8=B7=9F=E9=9A=8F=20shell=20=E8=83=8C=E6=99=AF?= =?UTF-8?q?=EF=BC=8C=E5=87=8F=E5=B0=91=E7=8A=B6=E6=80=81=E6=A0=8F=E5=8C=BA?= =?UTF-8?q?=E5=9F=9F=E9=97=AA=E7=99=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/main.dart | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/lib/main.dart b/lib/main.dart index d3632a5..2941477 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -164,7 +164,7 @@ class _H5ShellPageState extends State with WidgetsBindingObserver { onMessageReceived: (message) => _handleFlutterShellMessage(generation, message), ) - ..setBackgroundColor(Colors.white) + ..setBackgroundColor(Colors.transparent) ..setNavigationDelegate( NavigationDelegate( onProgress: (progress) { @@ -1009,6 +1009,12 @@ class _H5ShellPageState extends State with WidgetsBindingObserver { final shouldPaintShellFallback = (_isPreparingInitialLine || currentSlot.isAwaitingFirstScreen) && currentSlot.loadError == null; + final shouldPaintShellCover = + currentSlot.showShellCover && !currentSlot.hasPresentedFirstScreen; + final shouldPaintWebView = currentSlot.hasLoadedInitialRequest || + currentSlot.hasPresentedFirstScreen; + final shellBackgroundColor = + shouldPaintShellFallback ? _shellBackground : Colors.white; return PopScope( canPop: false, @@ -1018,20 +1024,20 @@ class _H5ShellPageState extends State with WidgetsBindingObserver { } }, child: Scaffold( - backgroundColor: Colors.white, + backgroundColor: shellBackgroundColor, body: Stack( children: [ SafeArea( bottom: false, child: Stack( children: [ - if (shouldPaintShellFallback) + if (shouldPaintShellFallback && !shouldPaintShellCover) Positioned.fill( child: _ShellFallback(progress: currentSlot.progress), ), - Positioned.fill(child: _buildWebViewWidget()), - if (currentSlot.showShellCover && - !currentSlot.hasPresentedFirstScreen) + if (shouldPaintWebView) + Positioned.fill(child: _buildWebViewWidget()), + if (shouldPaintShellCover) Positioned.fill( child: IgnorePointer( child: _ShellFallback(progress: currentSlot.progress), @@ -1060,8 +1066,7 @@ class _H5ShellPageState extends State with WidgetsBindingObserver { right: 0, height: topInset, child: ColoredBox( - color: - shouldPaintShellFallback ? _shellBackground : Colors.white, + color: shellBackgroundColor, ), ), ],