Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flutter native splash screen image problem

I'm using the flutter native splash screen package for customizing the default splash in my flutter splash screen. I added an image to the splash screen, but the image doesn't fit properly.

My current splash screen looks like this:

current splash screen

What I want to achieve:

desired splash screen

This is my pubspec file:

# flutter_native_splash-development.yaml
flutter_native_splash:
color: "#ffffff"
image: assets/icons/splash_icon.png
color_dark: "#121212"
image_dark:
fill: true
assets/icons/splash_icon.png

android_12:
    image: assets/icons/splash_icon.png
    image_dark: assets/icons/splash_icon.png
like image 477
NAMAN GAJERA Avatar asked Oct 12 '25 23:10

NAMAN GAJERA


2 Answers

Take a look at the details in the Android 12+ section of the readme. The splash image needs blank padding within the image as per Android 12+ Splash API requirements.

like image 103
jon Avatar answered Oct 14 '25 12:10

jon


Had the same issue, The following worked:
1. logo fixing: https://pub.dev/packages/flutter_native_splash#android-12-support
2. fixing AndroidMenifest file:

<manifest xmlns:android="http://schemas.android.com/apk/res/android">
    
    <application
        android:label="your_app_name"
        android:icon="@mipmap/ic_launcher"
        android:theme="@style/LaunchTheme">   <!-- Dont forget to add this --> 
        
        <activity
            android:name=".MainActivity"
            android:launchMode="singleTop"
            android:theme="@style/NormalTheme" 
            android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
            android:hardwareAccelerated="true"
            android:windowSoftInputMode="adjustResize">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>
        <!-- Other activities and services -->
    </application>
</manifest>

It worked for me after this fixes and running the

dart run flutter_native_splash:create

and then running flutter run/build

like image 33
Iftee Avatar answered Oct 14 '25 12:10

Iftee