Closed AbdulHaseeeb closed 1 year ago
What version of Android are you using? If you are using Android 12+ you need a config section specific to Android 12 since it handles the splash screen differently from prior version.
I've tested it on android 7. I think this command messed up something flutter pub run flutter_native_splash:remove
I ran these three commands one after the other flutter clean flutter pub get flutter pub run flutter_native_splash:create
I cannot reconfigure it, It have stopped working. Everytime I reinstall it and reset everything, with new image and all, it keeps showing blue screen.
what I've tried,
I'll be grateful if you'll explain why you've made it this way i.e write things in pubspec.yaml why not like this (excuse me I'm a beginner)
FlutterNativeSplash.preserve(
widgetsBinding: WidgetsFlutterBinding.ensureInitialized(),
widgetToDisplayWhenAppInitializes: Widget(),
android: true,
ios: true,
more_properties: ...,
);
//once everything initialize FlutterNativeSplash.remove();
It was not working on my app too when I changed my image. I think the proper way to do it is to use "remove" first and remove everything and then use "create" to create splash screen.
What I did to solve this is to create a new project in a different directory and then transfer all files from lib, copying dependencies from pubspec.yaml. and then use this package again to create splash screen.
You should not need to user the flutter pub run flutter_native_splash:remove
command to change your splash image. flutter pub run flutter_native_splash:create
will overwrite your splash image with a new one based on your pubspec.yaml
settings.
In answer to your question @AbdulHaseeeb about why the app is configured this way. On Android for example, the command line part of this package (flutter pub run flutter_native_splash:create
) must modify the images in the android folder of the app. These files are then compiled into an appbundle and placed on the play store. Then, when the end user runs the app, the FlutterNativeSplash.preserve()
code executes. At this point, it is too late to modify the splash image. It has already been baked into the app and displayed by the native platform before the FlutterNativeSplash.preserve()
code was executed. The preserve()
and remove()
commands simply allows the splash to continue to be displayed while you load app resources and then control when the splash screen is removed to present your app.
Please send me your app code if you would like me to try to figure out why this package is not configuring it correctly.
I did what @AbdulSamadgithub said and fixed it. Thank you though.
AbdulSamadgithub commented last week I did what @AbdulSamadgithub said and fixed it. Thank you though.
I think you posted that from the wrong account. 😆 Glad you resolved it.
I did what @AbdulSamadgithub said and fixed it. Thank you though.
please tell me what you did facing the same issue
pubspec.yaml
main
what I've tried flutter pub run flutter_native_splash:remove flutter pub run flutter_native_splash:create