I’m setting up native splash screen in flutter.
Problem :
I want to delete Flutter icon when app loads (on native level).
My AndroidManifest.xml
:
<application
android:label="@string/app_name"
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher">
<activity
android:name=".MainActivity"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
...
My styles.xml
:
<resources>
<style name="LaunchTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:windowBackground">@color/splash_background</item>
</style>
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
...
My colors.xml
:
<resources>
<color name="splash_background">#FFC0CB</color>
</resources>
2
Answers
Solution: You need to comment out this line in
AndroidManifest.xml
file.And after you need to reload flutter dependencies:
Removing the Native Splash Screen in Flutter
Understanding the Problem:
Flutter applications typically use a native splash screen for initial loading times. If you want to remove this and replace it with a custom Flutter splash screen or eliminate it entirely, here’s how:
Method 1: Using
flutter_native_splash
Package (Recommended)If you’ve used the
flutter_native_splash
package to generate your native splash screen, you can remove it using the following steps:pubspec.yaml
file and remove theflutter_native_splash
dependency.flutter pub run flutter_native_splash:remove
.flutter clean
to ensure all generated files are removed.Method 2: Manual Removal (Android)
If you haven’t used a package, you can manually remove the native splash screen for Android:
Delete the launch background:
android/app/src/main/res/drawable
and delete thelaunch_background.xml
file.Create a blank style:
splash_screen.xml
in the same directory with the following content:Apply the style:
AndroidManifest.xml
and add the following line to the<application>
tag:Method 3: Manual Removal (iOS)
For iOS, you can remove the launch screen by:
LaunchScreen.storyboard
file from your Xcode project.ios/Runner/Info.plist
and remove theUILaunchStoryboardName
key.Important Considerations:
SplashScreen
widget or a dedicated package.By following these steps, you can effectively remove the native splash screen from your Flutter application and customize the initial loading experience as needed.