An advanced Flutter package to seamlessly integrate native splash screens with customizable splash animations (Lottie, GIF, Image, Video) before transitioning to your main app.
- Dual Splash Workflow: Native splash → Custom splash → Main app
- Multiple Media Types: Lottie, GIF, Image, or Video splash screens
- Dynamic Configuration: Adjust duration, assets, and animation behavior
- Platform Support: Android, iOS, and Web ready
- Smooth Transitions: Preserved native splash prevents blank screens
- Clone the repository
git clone https://github.com/yourusername/my_splash_screen.git- Install dependencies
flutter pub get- Set up native splash (required for initial loading):
# Add to pubspec.yaml
flutter_native_splash:
color: "#ffffff"
image: "assets/splash_image.png"
android: true
ios: true
web: true- Generate native splash assets
flutter pub run flutter_native_splash:create| Asset Type | Recommended Location | Supported Formats |
|---|---|---|
| Lottie Animation | assets/lottie/ |
.json |
| GIF | assets/gifs/ |
.gif |
| Images | assets/images/ |
.png, .jpg |
| Videos | assets/videos/ |
.mp4 |
Modify config.dart to set default paths:
const String LOGO_MOTION_LOTTIE = 'assets/lottie/splash_animation.json';
const String LOGO_MOTION_GIF = 'assets/gifs/splash.gif';
const String LOGO_MOTION_IMAGE = 'assets/images/splash.png';
const String LOGO_MOTION_VIDEO = 'assets/videos/splash.mp4';return const SplashScreen(
typeOfSplashScreen: CustomSplashScreenType.lottie,
splashTimeout: 5, // Seconds
);1. Custom Asset Path
SplashScreen(
typeOfSplashScreen: CustomSplashScreenType.gif,
gifPath: 'assets/custom/cool_loading.gif',
splashTimeout: 3,
)2. Video Splash (Requires video player implementation)
SplashScreen(
typeOfSplashScreen: CustomSplashScreenType.video,
videoPath: 'assets/videos/awesome_intro.mp4',
splashTimeout: 10,
)3. Animation Control (Lottie-specific)
_controller
..duration = composition.duration
..repeat(reverse: true); // For looping animationControl total splash duration using:
splashTimeout: 5 // SecondsLottie.asset(
LOGO_MOTION_LOTTIE,
width: MediaQuery.of(context).size.width * 0.8,
height: MediaQuery.of(context).size.height * 0.6,
fit: BoxFit.contain,
)Scaffold(
backgroundColor: Colors.black, // Custom background
body: Center(...)
)Modify post-splash routing in splash_screen.dart:
Navigator.pushReplacementNamed(context, '/home'); // Change route nameQ: Assets not loading?
- Verify paths in
config.dart - Check
pubspec.yamlasset declarations - Run
flutter clean && flutter pub get
Q: Black screen between splashes?
- Ensure native splash is properly configured
- Verify
FlutterNativeSplash.remove()is called
Q: Animation stuttering?
- Optimize asset sizes (Lottie <1MB, Images <500KB)
- Pre-cache large assets before splash screen
- Video player integration
- Network-based splash content
- Adaptive dark/light mode
- Splash progress indicators
Contributions welcome! Please follow:
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit changes (
git commit -m 'Add amazing feature') - Push to branch (
git push origin feature/AmazingFeature) - Open a Pull Request
MIT License
Copyright (c) 2025 Mohammad Ah
Replace placeholder assets with your own media files for production use. For Lottie animations, consider using LottieFiles for optimized assets.