Reputation: 76
I want to set a splash screen for android 12 in flutter
I used flutter_native_splash package but it doesn't show my icon
I added it to the pybspec.yaml
file:
dependencies:
flutter:
sdk: flutter
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.2
flutter_native_splash: ^2.2.8
dev_dependencies:
flutter_test:
sdk: flutter
flutter_native_splash:
color: "#ffff00"
image: assets/splash.png
android_12:
image: assets/splash.png
# The "flutter_lints" package below contains a set of recommended lints to
# encourage good coding practices. The lint set provided by the package is
# activated in the `analysis_options.yaml` file located at the root of your
# package. See that file for information about deactivating specific lint
# rules and activating additional ones.
flutter_lints: ^2.0.0
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
# The following section is specific to Flutter packages.
flutter:
# The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in
# the material Icons class.
uses-material-design: true
# To add assets to your application, add an assets section, like this:
assets:
- assets/
and created a separated file splash.yaml
:
flutter_native_splash:
color: "#ffff00"
image: assets/splash.png
android_12:
image: assets/splash.png
the I ran this command flutter pub run flutter_native_splash:create --path=splash.yaml
it change the background color but it doesn't change the icon
I read the doc of the package and read this but I found nothing
Upvotes: 0
Views: 203
Reputation: 6510
Looking over your pubpsec.yaml file, under the assets key, you put the same key (a folder called assets).
# To add assets to your application, add an assets section, like this:
assets:
- assets/
I would try and rename your assets directory to something else to make sure there isn't a problem there.
Also, since I do not know what your assets directory contains or where in your project it is located, I would try and explicitly add your splash image in the pubspec.yaml:
# To add assets to your application, add an assets section, like this:
assets:
- images/splash.png
Make sure your assets directory is located in the correct place
Upvotes: 1