flutter

How to use the flutter native splash screen


I am facing trouble using the flutter native splash screen.A blank screen appears when i tried to use the flutter_native_splash package https://pub.dev/packages/flutter_native_splash


Solution

  • The actual and perfect way is not to add a page or use a plugin, you can even do it natively by this method: Go to => andoid > app > main > res > drawable > in this folder you can see a file called lauch_background open it,

    <?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/white" />
    
      <!-- You can insert your own image assets here -->
       <item>
        <bitmap
            android:gravity="fill"
            android:src="@mipmap/ic_launcher" />
      </item>
       </layer-list>
    

    add your image in the folder and rename the image file name to ic_launcher. Also uncomment the commented code in the file.