How to remove the default fade transition between the native splash screen and the home screen in flutter? (Using native splash screen only)

Viewed 1187

I have a native splash screen in flutter, but when the splash screen ends, it has a fade animation to my app home screen. I need to remove that, and still use the native splash. How can I do that?

1 Answers

Here is what I found:

  • Open your Android project inside your Flutter project
  • In you Android project, go to app/src/main/AndroidManifest.xml
  • in that AndroidManifest.xml file, you should find one activity block
  • in that block, comment or remove the two meta-data blocks, especially this one:
    <meta-data
        android:name="io.flutter.embedding.android.SplashScreenDrawable"
        android:resource="@drawable/launch-background" />

Not only the splash screen will still works, because you have android:theme=@style/LaunchTheme as attribute of the MainActivity, but il will also remove the glitch that you may have on your splash screen that shifts a little bit your logo (if you have one in your splash screen of course).

That solution works (at least for me) if you have a basic splash screen. I haven't tested that with a more advanced custom animated splash screen for example, so it might not be the perfect solution for everyone.

Related