Reputation: 19
I want to make the splash screen background transparent so that it shows only an icon on the screen when the app starts.
What I have done so far in launch_background.xml for Android:
<?xml version="1.0" encoding="utf-8"?>
<!-- Modify this file to customize your launch splash screen -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@android:color/transparent" />
<item>
<bitmap
android:src="@drawable/index"
android:gravity="center"
/>
</item>
</layer-list>
But what I got was a black background like:
The Image
What I want, something like this:
How to approach this problem properly? Thank you!
BTW: What about IOS?
Upvotes: 0
Views: 2488
Reputation: 873
You cannot make a splash screen transparent. You need to have a color property for the splash screen background, the best way is to define background colors for both the dark and light them
//pubspec.yaml
dependencies:
//Others
flutter_native_splash: ^2.4.0
flutter_native_splash:
color: "#f5f5f5"
image: "lib/assets/image_assets/splash_image_light.png"
color_dark: "#0F141A"
image_dark: "lib/assets/image_assets/splash_image_dark.png"
android_12:
color: "#f5f5f5"
image: "lib/assets/image_assets/splash_image_light.png"
color_dark: "#0F141A"
image_dark: "lib/assets/image_assets/splash_image_dark.png"
Upvotes: 0