You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何彻底移除Flutter默认白色启动页?无需自定义启动页

Alright, let's fix that pesky default white splash screen once and for all. If you want zero splash screen (no custom ones either) or to make it as short as physically possible, you need to tweak both Android and iOS native code since Flutter doesn't handle this out of the box. Here's how to do it step by step:

Android 端处理

The default white splash comes from native launch drawable and theme settings. Let's strip it entirely:

  • Open android/app/src/main/res/drawable/launch_background.xml and replace its contents with a fully transparent layer list:
    <?xml version="1.0" encoding="utf-8"?>
    <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
        <item android:drawable="@android:color/transparent" />
    </layer-list>
    
  • Next, open android/app/src/main/res/values/styles.xml and update the LaunchTheme to enforce transparency and remove any overlay:
    <style name="LaunchTheme" parent="@android:style/Theme.Light.NoTitleBar">
        <item name="android:windowBackground">@android:color/transparent</item>
        <item name="android:windowContentOverlay">@null</item>
    </style>
    
  • For Android 12 and above: Google introduced the SplashScreen API, which might still show a default screen if not disabled. Add this meta-data tag inside the <application> section of android/app/src/main/AndroidManifest.xml:
    <meta-data
        android:name="android.splashscreen.enabled"
        android:value="false" />
    
iOS 端处理

iOS uses a storyboard for the launch screen, so we'll make that fully transparent:

  • Open your project in Xcode, navigate to ios/Runner/LaunchScreen.storyboard.
  • Select the main View (the background of the launch screen) in the storyboard editor. In the Attributes Inspector, set the Background color to Clear Color.
  • Double-check your Info.plist file (also in the ios/Runner folder) to ensure there are no leftover launch image configurations. If you previously used launch images instead of the storyboard, delete all those image assets from your project.

Bonus: Minimizing any remaining "flash"

If you still see a tiny split-second flash (from Flutter's initial setup), you can set your Flutter app's initial screen background to match whatever your native app's transparent state transitions to. But with the above steps, you should get as close to "no splash screen" as possible.

内容的提问来源于stack exchange,提问作者Zohaib Hamdule

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.08 08:42:34