Splash
For Android, you should provide images for different density buckets. Here are the recommended dimensions for each density:
- mdpi (baseline): 1x, Dimensions: Original size (e.g., 320x480 for a full-screen image)
- hdpi: 1.5x, Dimensions: 1.5 times the mdpi size (e.g., 480x720 for a full-screen image)
- xhdpi: 2x, Dimensions: 2 times the mdpi size (e.g., 640x960 for a full-screen image)
- xxhdpi: 3x, Dimensions: 3 times the mdpi size (e.g., 960x1440 for a full-screen image)
- xxxhdpi: 4x, Dimensions: 4 times the mdpi size (e.g., 1280x1920 for a full-screen image)
For iOS, you should provide images for different scale factors. Here are the recommended dimensions for each scale factor:
- 1x: Original size (e.g., 320x480 for a full-screen image)
- 2x: 2 times the original size (e.g., 640x960 for a full-screen image)
- 3x: 3 times the original size (e.g., 960x1440 for a full-screen image)
Assuming the original image size is 320x480 (mdpi or 1x):
Android:
- mdpi: 320x480
- hdpi: 480x720
- xhdpi: 640x960
- xxhdpi: 960x1440
- xxxhdpi: 1280x1920
iOS:
- 1x: 320x480
- 2x: 640x960
- 3x: 960x1440
Ensure that you place the images in the correct directories:
android/app/src/main/res/drawable-mdpi/splash_image.webpandroid/app/src/main/res/drawable-hdpi/splash_image.webpandroid/app/src/main/res/drawable-xhdpi/splash_image.webpandroid/app/src/main/res/drawable-xxhdpi/splash_image.webpandroid/app/src/main/res/drawable-xxxhdpi/splash_image.webp
ios/Runner/Assets.xcassets/LaunchImage.imageset/splash_image@1x.webpios/Runner/Assets.xcassets/LaunchImage.imageset/splash_image@2x.webpios/Runner/Assets.xcassets/LaunchImage.imageset/splash_image@3x.webp
To provide a native splash screen that displays before the Flutter framework is initialized, you need to configure the native splash screens for both Android and iOS.
Update
android/app/src/main/res/drawable/launch_background.xml: Create or update thelaunch_background.xmlfile to include yourwebpimage:<?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item> <bitmap android:gravity="center" android:src="@drawable/splash_image" /> </item> </layer-list>Update
android/app/src/main/res/values/styles.xml: Ensure that thestyles.xmlfile includes the splash screen theme:<style name="LaunchTheme" parent="Theme.AppCompat.Light.NoActionBar"> <item name="android:windowBackground">@drawable/launch_background</item> </style>Update
AndroidManifest.xml: Set the splash screen theme in theAndroidManifest.xmlfile:<application android:label="your_app_name" android:icon="@mipmap/ic_launcher" android:theme="@style/LaunchTheme"> <!-- Other configurations --> </application>
Update
ios/Runner/Assets.xcassets/LaunchImage.imageset: Add yourwebpimage to theLaunchImage.imagesetdirectory.Update
ios/Runner/Info.plist: Ensure that theInfo.plistfile includes the splash screen configuration:<key>UILaunchImages</key> <array> <dict> <key>UILaunchImageMinimumOSVersion</key> <string>8.0</string> <key>UILaunchImageName</key> <string>LaunchImage</string> <key>UILaunchImageOrientation</key> <string>Portrait</string> <key>UILaunchImageSize</key> <string>{320, 480}</string> </dict> <dict> <key>UILaunchImageMinimumOSVersion</key> <string>8.0</string> <key>UILaunchImageName</key> <string>LaunchImage2@</string> <key>UILaunchImageOrientation</key> <string>Portrait</string> <key>UILaunchImageSize</key> <string>{640, 960}</string> </dict> <dict> <key>UILaunchImageMinimumOSVersion</key> <string>8.0</string> <key>UILaunchImageName</key> <string>LaunchImage2@</string> <key>UILaunchImageOrientation</key> <string>Portrait</string> <key>UILaunchImageSize</key> <string>{960, 1440}</string> </dict> </array>