Reputation: 89
i have a problem with splash screen in android with Flutter, still white in physical device and emulator. Already tried to unistall app. Some advice?
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/red" />
<!-- You can insert your own image assets here
<item>
<bitmap
android:gravity="center"
android:src="@drawable/logo" />
</item>-->
if i comment this, it show black:
<meta-data
android:name="io.flutter.embedding.android.SplashScreenDrawable"
android:resource="@drawable/launch_background"
/>
Upvotes: 0
Views: 1605
Reputation: 1452
for android
add splash screen image (1080x1940 pixel) inside drawable folder, then open app -> src -> main -> res
Inside the drawable folder, you will find launch_background.xml edit it. see details example here
<?xml version="1.0" encoding="utf-8"?>
<!-- You can insert your own splash image assets here -->
<item>
<bitmap
android:gravity="center"
android:src="@drawable/splash_screen" />
</item>
Thats it
For iOS app
Open flutter project on Xcode for Adding splash screen to flutter ios app. To open the iOS module on Xcode, open android studio and on the top menu select tools. Go to flutter –> open ios module on Xcode.
On Xcode window, Click on Runner-> Runner -> Assets.xcassets folder. Here you can see LaunchImage paste your splash screen image with all three different dimensions in this folder.
Open LaunchScreen.storyboard
Again on the left side menu just below the Assets.xcassets folder, you will see LaunchScreen.Storyboard. Click on view controller scene -> view controller -> view. Note: – select (click on ) view only don’t click on LaunchImage. You already paste the new splash screen in the LaunchImage folder in the previous step. So you will see the same new image here in this window. When you select (click on ) view then on the right side window you can see options to change view settings like content mode, background, alpha etc. change the background colour as you want and set content mode to scale to fill.
Adjust Splash Screen You can adjust the splash screen position, size & background colour on the same window. Just click on launchImage OR select the image on the preview window. You can resize the image and can adjust the image position. On the Right side window, you can make another setting as well.
iOS App Splash Screen is Ready. Now flutter white splash screen problem has been resolved successfully for both android and iOS. You can change the flutter splash screen background color as per your requirements.
Upvotes: 0
Reputation: 327
You could check the flutter_native_splash package. It'll replace the color on IOS & Android automatically.
Update : It worked with me fine :
Use :
dev_dependencies:
flutter_test:
sdk: flutter
flutter_native_splash: ^0.1.9
flutter_native_splash:
color: "FF0000"
then run the command again :
flutter pub pub run flutter_native_splash:create
Upvotes: 1