I am new to Flutter, and I did try to switch the splash screen logo and the background color with methods below but failed. I have tried to Googled some solutions and tried but none have worked for me.
2 Methods mentioned below doesn’t work for me. When I run the program, it still show the default splash screen ignoring my background image and logo. 2nd method is just to try commenting out the logo to see whether it would update the splash screen but it doesn’t. I try my Samsung A53 5G and Android Emulator (Pixel 7 Pro API 33). For Method 1, I did check the drawable files, the images in the drawable are already updated so means it should already worked but it doesn’t. I am not sure what to do. Please help.
Method 1: Using Flutter Native Splash
- Added Dependencies on pubspec.yaml
Execution of Creating Native Splash
- on my Project Terminal I execute, dart run flutter_native_splash:create
Note: I am sure flutter pub get after adding the dependencies
Method 2: Manually Attempting to Comment out the Logo
For this method I try by going to android/app/main/res/drawable/launch_background.xml Comment out
<item> <bitmap android:gravity="fill" android:src="@drawable/splash"/> </item>
Method I have tried:
https://stackoverflow.com/questions/68964948/flutter-splash-screen-not-showing
https://stackoverflow.com/questions/74077097/flutter-splash-screen-doesnt-update-when-changed
https://stackoverflow.com/questions/73146269/how-to-remove-flutters-default-splash-screen#:~:text=1%20Answer&text=The%20default%20splash%20screen%20cannot,after%20the%20default%20splash%20screen
>Solution :
Android 12 introduced a new method of adding splash screens, and the flutter_native_splash
package has its own setup for providing splash screens in Android 12+ (see the documentation here).
As a quick fix, you can do this:
flutter_native_splash:
color: "#FFFFFF"
image: assets/splash_screen.png
color_dark: "#1a1a1a"
image_dark: assets/splash_screen.png
# add this
android_12:
icon_background_color: "#FFFFFF"
image: assets/splash_screen.png
icon_background_color_dark: "#1a1a1a"
image_dark: assets/splash_screen.png