3

I've been trying to add a splashscreen to my app, but every configuration that I've tried doesn't produce a nice result.

enter image description here

This was the last and simplest attempt that I've tried. I'm testing in on a Samsung Galaxy S21 FE running android 13. I've also tested it with the Android Studio emulator on a Pixel 6 running Android 13 with the same result. My test with a Nexus 5X emulator running Android 11 doesn't have the two size image problem. I'm using flutter_native_splash: ^2.2.18to generate the splash screen. This is my flutter_native_splash.yaml config:

flutter_native_splash:
  color: "#eeeeee"
  image: assets/launcher/launcher.png

  android_12:
    image: assets/launcher/launcher_android_12.png
    color: "#eeeeee"

  web: false

And these are the two images.

launcher_android_12.png

enter image description here

launcher.png

enter image description here

I've tried using both of the images on the general and android_12 config but neither of them generates a better result. I'd expect to see a continuous splash screen instead of a large image followed by a smaller one.

Gandalf
  • 113
  • 8
  • you can try adjusting the configuration for the resize_mode property to control how the image is scaled or resized to fit the screen – angwrk Mar 05 '23 at 15:02
  • @angwrk where would that attribute go? I don't see it on `flutter_native_splash ` documentation – Gandalf Mar 05 '23 at 15:34
  • for example it may help you: https://www.youtube.com/watch?v=8ME8Czqc-Oc – angwrk Mar 05 '23 at 16:28
  • 1
    @angwrk the video that you pointed at was made 2 years ago and doesn't have the android_12 config. My problem is with Android 12 and 13 (with Android 11 the splash screen looks fine) – Gandalf Mar 05 '23 at 21:50

1 Answers1

4

Somehow I managed to fix it.

I followed this instruction Deprecated Splash Screen API Migration on flutter's docs.

In my case I had to simply remove this in AndroidManifest.xml

            <meta-data
                android:name="io.flutter.embedding.android.SplashScreenDrawable"
                android:resource="@drawable/launch_background" />

Gandalf
  • 113
  • 8