I’m creating a splash screen using the native splash screen package.
I tried to give a GIF image in the background of the splash screen. But it didn’t work. Is there a way to render a GIF image in a full splash screen?
Code:
flutter_native_splash: ^2.2.17
flutter_native_splash:
color: "#94f301"
android_12:
color: "#94f301"
backgoround_image_android: assets/images/splash.gif
fullscreen: true
2
Answers
you can use flutter_native_splash (https://pub.dev/packages/flutter_native_splash)
and this is how to use it:
Add the flutter_native_splash package to your pubspec.yaml file and run
flutter pub get
to install it:In the pubspec.yaml file, add the following lines to define the splash screen settings:
Run
flutter pub run flutter_native_splash:create
to generate the native splash screen files for Android and iOS.In your main.dart file, add the following lines to import the flutter_native_splash.dart file and initialize the splash screen:
Build and run your app to see the GIF image displayed on the native splash screen.
Note: Make sure to test the splash screen on actual devices, as some emulators may not display the native splash screen correctly.
Add This package flutter_native_splash
Add this into android/app/src/main/res/values
Add the following code to the flutter_native_splash section of your pubspec.yaml file: