custom_animated_splash 0.0.1
custom_animated_splash: ^0.0.1 copied to clipboard
A customizable animated splash screen for Flutter apps using Lottie and native splash support.
custom_animated_splash #
A Flutter package to automate the creation and integration of a customizable animated splash screen, including native splash background color synchronization for both Android and iOS—without any dependency on external splash plugins.
Features #
- Reads splash background color from your app's
pubspec.yamlundercustom_animated_splash: - Generates a Flutter splash page that displays a Lottie animation (
assets/splash.json) - Automatically updates native splash background color for Android and iOS
- One-command setup for both native and Flutter splash screens
Getting started #
-
Add this package to your app's dependencies:
dependencies: custom_animated_splash: -
Add the splash color to your app's pubspec.yaml:
custom_animated_splash: color: "#FF0000" # Use any hex color you want -
Add your splash animation asset:
- Place your Lottie animation file at
assets/splash.json - Register the asset in your pubspec.yaml:
flutter: assets: - assets/splash.json
- Place your Lottie animation file at
-
Run the splash creation script from your app root:
dart run custom_animated_splash:bin/create_animated_splash.dart- This generates the Flutter splash page and updates native splash colors.
-
Rebuild your project:
flutter clean flutter run
Usage #
- Import and use the generated splash page in your app:
import 'package:custom_animated_splash/src/custom_animated_splash/custom_animated_splash_page.dart'; // Use CustomAnimatedSplashPage() as your initial route/page - The splash page will show your animation for 3 seconds, then navigate to
GoPage()(replace or implement as needed).
How it works #
- Reads the color you set in
custom_animated_splash.colorin your app's pubspec.yaml - Updates Android's
colors.xmlandlaunch_background.xmland iOS'sLaunchScreen.storyboardwith the specified color - Generates a Flutter splash widget that uses the same color and plays the Lottie animation
- No external splash dependency required
Additional information #
- If you change the color or animation, re-run the script and rebuild your app
- If you encounter issues, please file an issue on the repository
- PRs and contributions are welcome!