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
CodePudding user response:
refer this example for you native splash screen https://www.codegrepper.com/code-examples/whatever/flutter native splash screen
CodePudding user response:
Create a new assets and logo folder in your root project path and place your splash_screen_logo.png
like project_name/assets/logos/splash_screen_logo.png
Add flutter_native_splash: ^2.1.1
at dev_dependencies
in pubspec.yaml
dev_dependencies:
flutter_test:
sdk: flutter
flutter_native_splash: ^2.1.1
Paste this below code in your pubspec.yaml
and change the color and image asset path
flutter_native_splash:
color: "#071b5d"
image: assets/logos/splash_screen_logo.png
android: true
ios: true
Finally in your project path terminal run this command: flutter pub run flutter_native_splash:create
CodePudding user response:
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.